Differences

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

library_example_check_existence_timestamp 2017-10-03 library_example_check_existence_timestamp 2022-06-16 (current)
Line 24: Line 24:
                UserName = "user",                 UserName = "user",
                Password = "mypassword",                 Password = "mypassword",
-                SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..."+                SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx..."
            };             };
Line 35: Line 35:
                string fileName = "export_" + stamp + ".txt";                 string fileName = "export_" + stamp + ".txt";
                string remotePath = "/home/user/sysbatch/" + fileName;                 string remotePath = "/home/user/sysbatch/" + fileName;
-                string localPath = "d:\\backup\\" + fileName;+                string localPath = @"d:\backup\" + fileName;
                // Manual "remote to local" synchronization.                 // Manual "remote to local" synchronization.
Line 121: Line 121:
                .UserName = "user"                 .UserName = "user"
                .Password = "mypassword"                 .Password = "mypassword"
-                .SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..."+                .SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx..."
            End With             End With
Line 207: Line 207:
        UserName = "user"         UserName = "user"
        Password = "mypassword"         Password = "mypassword"
-        SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..."+        SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx..."
    }     }
Line 282: Line 282:
    exit 0     exit 0
} }
-catch [Exception]+catch
{ {
    Write-Host "Error: $($_.Exception.Message)"     Write-Host "Error: $($_.Exception.Message)"
Line 305: Line 305:
    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...";+    sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx...";
       
    var session = WScript.CreateObject("WinSCP.Session");     var session = WScript.CreateObject("WinSCP.Session");
Line 331: Line 331:
        // transferOptions.FileMask = fileName;         // transferOptions.FileMask = fileName;
        // session.SynchronizeDirectories(         // session.SynchronizeDirectories(
-        //    SynchronizationMode_Local, localPath, remotePath, false, false, SynchronizationCriteria_Time,  +        //    SynchronizationMode_Local, localPath, remotePath, false, false, 
-        //    transferOptions).Check();+        //    SynchronizationCriteria_Time, transferOptions).Check();
        if (session.FileExists(remotePath))         if (session.FileExists(remotePath))
        {         {
Line 338: Line 338:
            if (!fs.FileExists(localPath))             if (!fs.FileExists(localPath))
            {             {
-                WScript.Echo("File " + remotePath + " exists, local backup " + localPath + " does not");+                WScript.Echo( 
 +····················"File " + remotePath + " exists, local backup " + localPath + " does not");
                download = true;                 download = true;
            }             }
Line 349: Line 350:
                {                 {
                    WScript.Echo(                     WScript.Echo(
-                        "File " + remotePath + " as well as local backup " + localPath + " exist, "+                        "File " + remotePath + " as well as local backup " + localPath + 
-                        "but remote file is newer (" + remoteWriteTime + ") than local backup (" + localWriteTime + ")");+                        " exist, but remote file is newer (" + remoteWriteTime + ") than " + 
 +                        "local backup (" + localWriteTime + ")");
                    download = true;                     download = true;
                }                 }
Line 356: Line 358:
                {                 {
                    WScript.Echo(                     WScript.Echo(
-                        "File " + remotePath + " as well as local backup " + localPath + " exist, " + +                        "File " + remotePath + " as well as local backup " + localPath + 
-                        "but remote file is not newer (" + remoteWriteTime + ") than " + + ·······················" exist, but remote file is not newer (" + remoteWriteTime + ") than " + 
-                        "local backup local backup (" + localWriteTime + ")");+                        "local backup (" + localWriteTime + ")");
                    download = false;                     download = false;
                }                 }
Line 411: Line 413:
    .UserName = "user"     .UserName = "user"
    .Password = "mypassword"     .Password = "mypassword"
-    .SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..."+    .SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx..."
End With End With
Line 447: Line 449:
' transferOptions.FileMask = fileName ' transferOptions.FileMask = fileName
' session.SynchronizeDirectories( _ ' session.SynchronizeDirectories( _
-'    SynchronizationMode_Local, localPath, remotePath, false, false, SynchronizationCriteria_Time, _ +'    SynchronizationMode_Local, localPath, remotePath, false, false, _ 
-'    transferOptions).Check+'    SynchronizationCriteria_Time, transferOptions).Check
Dim download, remoteWriteTime, localWriteTime Dim download, remoteWriteTime, localWriteTime
Line 463: Line 465:
            WScript.Echo _             WScript.Echo _
                "File " & remotePath & " as well as local backup " & localPath & " exist, " & _                 "File " & remotePath & " as well as local backup " & localPath & " exist, " & _
-                "but remote file is newer (" & remoteWriteTime & ") than local backup (" & localWriteTime & ")"+                "but remote file is newer (" & remoteWriteTime & ") than " & _ 
 +                "local backup (" & localWriteTime & ")"
            download = True             download = True
        Else         Else
Line 469: Line 472:
                "File " & remotePath & " as well as local backup " & localPath & " exist, " & _                 "File " & remotePath & " as well as local backup " & localPath & " exist, " & _
                "but remote file is not newer (" & remoteWriteTime & ") than " & _                 "but remote file is not newer (" & remoteWriteTime & ") than " & _
-                "local backup local backup (" & localWriteTime & ")"+                "local backup (" & localWriteTime & ")"
            download = False             download = False
        End If         End If

Last modified: by martin