Differences

This shows you the differences between the selected revisions of the page.

2016-09-29 2017-10-03
full -Format switch name (martin) using variable expansion in strings in powershell (martin)
Line 225: Line 225:
            {             {
                Write-Host (                 Write-Host (
-                    "File {0} exists, local backup {1} does not" -f +                    "File $remotePath exists, local backup $localPath does not")
-                    $remotePath, $localPath)+
                $download = $True                 $download = $True
            }             }
Line 236: Line 235:
                if ($remoteWriteTime -gt $localWriteTime)                 if ($remoteWriteTime -gt $localWriteTime)
                {                 {
-                    Write-Host +                    Write-Host ("File $remotePath as well as local backup $localPath exist, " + 
-························("File {0} as well as local backup {1} exist, " + + ·······················"but remote file is newer ($remoteWriteTime) than local backup ($localWriteTime)")
- ························"but remote file is newer ({2}) than local backup ({3})") -f +
-                        $remotePath, $localPath, $remoteWriteTime, $localWriteTime)+
                    $download = $True                     $download = $True
                }                 }
Line 245: Line 242:
                {                 {
                    Write-Host (                     Write-Host (
-                        ("File {0} as well as local backup {1} exist, " + +                        "File $remotePath as well as local backup $localPath exist, " + 
- ························"but remote file is not newer ({2}) than local backup ({3})") -f + ·······················"but remote file is not newer ($remoteWriteTime) than local backup ($localWriteTime)")
-                        $remotePath, $localPath, $remoteWriteTime, $localWriteTime)+
                    $download = $False                     $download = $False
                }                 }
Line 262: Line 258:
        else         else
        {         {
-            Write-Host ("File {0} does not exist yet" -f $remotePath)+            Write-Host "File $remotePath does not exist yet"
        }         }
    }     }
Line 275: Line 271:
catch [Exception] catch [Exception]
{ {
-    Write-Host ("Error: {0}" -f $_.Exception.Message)+    Write-Host "Error: ${$_.Exception.Message}"
    exit 1     exit 1
} }

Last modified: by martin