Differences
This shows you the differences between the selected revisions of the page.
2017-10-04 | 2017-10-04 | ||
using variable expansion in strings in powershell (martin) | code wrapping for new design + typo (martin) | ||
Line 69: | Line 69: | ||
UserName = "user", | UserName = "user", | ||
Password = "mypassword", | Password = "mypassword", | ||
- | SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" | + | SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..." |
}; | }; | ||
Line 84: | Line 84: | ||
synchronizationResult = | synchronizationResult = | ||
session.SynchronizeDirectories( | session.SynchronizeDirectories( | ||
- | SynchronizationMode.Remote, @"d:\www", "/home/martin/public_html", false); | + | SynchronizationMode.Remote, @"d:\www", |
+ | ·······················"/home/martin/public_html", false); | ||
// Throw on any error | // Throw on any error | ||
Line 114: | Line 115: | ||
if (e.Chmod.Error == null) | if (e.Chmod.Error == null) | ||
{ | { | ||
- | Console.WriteLine("Permisions of {0} set to {1}", e.Chmod.FileName, e.Chmod.FilePermissions); | + | Console.WriteLine( |
+ | ····················"Permissions of {0} set to {1}", e.Chmod.FileName, e.Chmod.FilePermissions); | ||
} | } | ||
else | else | ||
{ | { | ||
- | Console.WriteLine("Setting permissions of {0} failed: {1}", e.Chmod.FileName, e.Chmod.Error); | + | Console.WriteLine( |
+ | ····················"Setting permissions of {0} failed: {1}", e.Chmod.FileName, e.Chmod.Error); | ||
} | } | ||
} | } | ||
Line 130: | Line 133: | ||
if (e.Touch.Error == null) | if (e.Touch.Error == null) | ||
{ | { | ||
- | Console.WriteLine("Timestamp of {0} set to {1}", e.Touch.FileName, e.Touch.LastWriteTime); | + | Console.WriteLine( |
+ | ····················"Timestamp of {0} set to {1}", e.Touch.FileName, e.Touch.LastWriteTime); | ||
} | } | ||
else | else | ||
{ | { | ||
- | Console.WriteLine("Setting timestamp of {0} failed: {1}", e.Touch.FileName, e.Touch.Error); | + | Console.WriteLine( |
+ | ····················"Setting timestamp of {0} failed: {1}", e.Touch.FileName, e.Touch.Error); | ||
} | } | ||
} | } | ||
Line 140: | Line 145: | ||
{ | { | ||
// This should never happen during "local to remote" synchronization | // This should never happen during "local to remote" synchronization | ||
- | Console.WriteLine("Timestamp of {0} kept with its default (current time)", e.Destination); | + | Console.WriteLine( |
+ | ················"Timestamp of {0} kept with its default (current time)", e.Destination); | ||
} | } | ||
} | } | ||
Line 162: | Line 168: | ||
.UserName = "user" | .UserName = "user" | ||
.Password = "mypassword" | .Password = "mypassword" | ||
- | .SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" | + | .SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..." |
End With | End With | ||
Line 200: | Line 206: | ||
If e.Chmod IsNot Nothing Then | If e.Chmod IsNot Nothing Then | ||
If e.Chmod.Error Is Nothing Then | If e.Chmod.Error Is Nothing Then | ||
- | Console.WriteLine("Permisions of {0} set to {1}", e.Chmod.FileName, e.Chmod.FilePermissions) | + | Console.WriteLine( |
+ | ····················"Permissions of {0} set to {1}", e.Chmod.FileName, e.Chmod.FilePermissions) | ||
Else | Else | ||
- | Console.WriteLine("Setting permissions of {0} failed: {1}", e.Chmod.FileName, e.Chmod.Error) | + | Console.WriteLine( |
+ | ····················"Setting permissions of {0} failed: {1}", e.Chmod.FileName, e.Chmod.Error) | ||
End If | End If | ||
Else | Else | ||
Line 210: | Line 218: | ||
If e.Touch IsNot Nothing Then | If e.Touch IsNot Nothing Then | ||
If e.Touch.Error Is Nothing Then | If e.Touch.Error Is Nothing Then | ||
- | Console.WriteLine("Timestamp of {0} set to {1}", e.Touch.FileName, e.Touch.LastWriteTime) | + | Console.WriteLine( |
+ | ····················"Timestamp of {0} set to {1}", e.Touch.FileName, e.Touch.LastWriteTime) | ||
Else | Else | ||
- | Console.WriteLine("Setting timestamp of {0} failed: {1}", e.Touch.FileName, e.Touch.Error) | + | Console.WriteLine( |
+ | ····················"Setting timestamp of {0} failed: {1}", e.Touch.FileName, e.Touch.Error) | ||
End If | End If | ||
Else | Else | ||
' This should never happen during "local to remote" synchronization | ' This should never happen during "local to remote" synchronization | ||
- | Console.WriteLine("Timestamp of {0} kept with its default (current time)", e.Destination) | + | Console.WriteLine( |
+ | ················"Timestamp of {0} kept with its default (current time)", e.Destination) | ||
End If | End If | ||
Line 250: | Line 261: | ||
if ($e.Chmod.Error -eq $Null) | if ($e.Chmod.Error -eq $Null) | ||
{ | { | ||
- | Write-Host "Permisions of $($e.Chmod.FileName) set to $($e.Chmod.FilePermissions)" | + | Write-Host "Permissions of $($e.Chmod.FileName) set to $($e.Chmod.FilePermissions)" |
} | } | ||
else | else | ||
Line 350: | Line 361: | ||
if (e.Chmod.Error == null) | if (e.Chmod.Error == null) | ||
{ | { | ||
- | WScript.Echo("Permisions of " + e.Chmod.FileName + " set to " + e.Chmod.FilePermissions); | + | WScript.Echo( |
+ | ················"Permissions of " + e.Chmod.FileName + " set to " + e.Chmod.FilePermissions); | ||
} | } | ||
else | else | ||
{ | { | ||
- | WScript.Echo("Setting permissions of " + e.Chmod.FileName + " failed: " + e.Chmod.Error); | + | WScript.Echo( |
+ | ················"Setting permissions of " + e.Chmod.FileName + " failed: " + e.Chmod.Error); | ||
} | } | ||
} | } | ||
Line 366: | Line 379: | ||
if (e.Touch.Error == null) | if (e.Touch.Error == null) | ||
{ | { | ||
- | WScript.Echo("Timestamp of " + e.Touch.FileName + " set to " + e.Touch.LastWriteTime); | + | WScript.Echo( |
+ | ················"Timestamp of " + e.Touch.FileName + " set to " + e.Touch.LastWriteTime); | ||
} | } | ||
else | else | ||
{ | { | ||
- | WScript.Echo("Setting timestamp of " + e.Touch.FileName + " failed: " + e.Touch.Error); | + | WScript.Echo( |
+ | ················"Setting timestamp of " + e.Touch.FileName + " failed: " + e.Touch.Error); | ||
} | } | ||
} | } | ||
Line 376: | Line 391: | ||
{ | { | ||
// This should never happen during "local to remote" synchronization | // This should never happen during "local to remote" synchronization | ||
- | WScript.Echo("Timestamp of " + e.Destination + " kept with its default (current time)"); | + | WScript.Echo( |
+ | ············"Timestamp of " + e.Destination + " kept with its default (current time)"); | ||
} | } | ||
} | } | ||
Line 390: | Line 406: | ||
sessionOptions.UserName = "user"; | sessionOptions.UserName = "user"; | ||
sessionOptions.Password = "mypassword"; | sessionOptions.Password = "mypassword"; | ||
- | sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"; | + | sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..."; |
var session = WScript.CreateObject("WinSCP.Session", "session_"); | var session = WScript.CreateObject("WinSCP.Session", "session_"); |