Differences
This shows you the differences between the selected revisions of the page.
2017-10-03 | 2017-10-03 | ||
expand syntax (martin) | code wrapping for new design (martin) | ||
Line 41: | Line 41: | ||
// You can achieve the same using: | // You can achieve the same using: | ||
// session.SynchronizeDirectories( | // session.SynchronizeDirectories( | ||
- | // SynchronizationMode.Local, localPath, remotePath, false, false, SynchronizationCriteria.Time, | + | // SynchronizationMode.Local, localPath, remotePath, false, false, |
- | // new TransferOptions { FileMask = fileName }).Check(); | + | // SynchronizationCriteria.Time, new TransferOptions { FileMask = fileName }).Check(); |
if (session.FileExists(remotePath)) | if (session.FileExists(remotePath)) | ||
{ | { | ||
Line 48: | Line 48: | ||
if (!File.Exists(localPath)) | if (!File.Exists(localPath)) | ||
{ | { | ||
- | Console.WriteLine("File {0} exists, local backup {1} does not", remotePath, localPath); | + | Console.WriteLine( |
+ | ····························"File {0} exists, local backup {1} does not", remotePath, localPath); | ||
download = true; | download = true; | ||
} | } | ||
Line 124: | Line 125: | ||
session.Open(sessionOptions) | session.Open(sessionOptions) | ||
- | Dim stamp As String = DateTime.Now.ToString("yyyyMMdd", CultureInfo.InvariantCulture) | + | Dim stamp As String = |
+ | ···················DateTime.Now.ToString("yyyyMMdd", CultureInfo.InvariantCulture) | ||
Dim fileName As String = "export_" & stamp & ".txt" | Dim fileName As String = "export_" & stamp & ".txt" | ||
Dim remotePath As String = "/home/user/sysbatch/" & fileName | Dim remotePath As String = "/home/user/sysbatch/" & fileName | ||
Line 133: | Line 135: | ||
' You can achieve the same using: | ' You can achieve the same using: | ||
' session.SynchronizeDirectories( _ | ' session.SynchronizeDirectories( _ | ||
- | ' SynchronizationMode.Local, localPath, remotePath, False, False, SynchronizationCriteria.Time, _ | + | ' SynchronizationMode.Local, localPath, remotePath, False, False, _ |
- | ' New TransferOptions With { .FileMask = fileName }).Check | + | ' SynchronizationCriteria.Time, New TransferOptions With { .FileMask = fileName }).Check |
If session.FileExists(remotePath) Then | If session.FileExists(remotePath) Then | ||
Dim download As Boolean | Dim download As Boolean | ||
Line 141: | Line 143: | ||
download = True | download = True | ||
Else | Else | ||
- | Dim remoteWriteTime As DateTime = session.GetFileInfo(remotePath).LastWriteTime | + | Dim remoteWriteTime As DateTime = |
+ | ···························session.GetFileInfo(remotePath).LastWriteTime | ||
Dim localWriteTime As DateTime = File.GetLastWriteTime(localPath) | Dim localWriteTime As DateTime = File.GetLastWriteTime(localPath) | ||
Line 147: | Line 150: | ||
Console.WriteLine( _ | Console.WriteLine( _ | ||
"File {0} as well as local backup {1} exist, " & _ | "File {0} as well as local backup {1} exist, " & _ | ||
- | "but remote file is newer ({2}) than local backup ({3})", _ | + | "but remote file is newer ({2}) than " & _ |
+ | "local backup ({3})", _ | ||
remotePath, localPath, remoteWriteTime, localWriteTime) | remotePath, localPath, remoteWriteTime, localWriteTime) | ||
download = True | download = True | ||
Line 153: | Line 157: | ||
Console.WriteLine( _ | Console.WriteLine( _ | ||
"File {0} as well as local backup {1} exist, " & _ | "File {0} as well as local backup {1} exist, " & _ | ||
- | "but remote file is not newer ({2}) than local backup ({3})", _ | + | "but remote file is not newer ({2}) than " & _ |
+ | "local backup ({3})", _ | ||
remotePath, localPath, remoteWriteTime, localWriteTime) | remotePath, localPath, remoteWriteTime, localWriteTime) | ||
download = False | download = False |