Differences

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

library_session_getfiles 2019-10-23 library_session_getfiles 2022-08-12 (current)
Line 2: Line 2:
[[task_download|Downloads]] one or more files from remote directory to local directory. [[task_download|Downloads]] one or more files from remote directory to local directory.
-You can have WinSCP [[ui_generateurl|generate a code template]] for ''Session.GetFiles'' for you.+You can have WinSCP [[guide_automation#generating|generate a code template]] for ''Session.GetFiles'' for you.
The method is quite powerful, but due to a wide range of it uses, its syntax can be cumbersome initially. For specific tasks, consider using convenient alternatives: [[library_session_getfilestodirectory|''Session.GetFilesToDirectory'']] and [[library_session_getfiletodirectory|''Session.GetFileToDirectory'']]. The method is quite powerful, but due to a wide range of it uses, its syntax can be cumbersome initially. For specific tasks, consider using convenient alternatives: [[library_session_getfilestodirectory|''Session.GetFilesToDirectory'']] and [[library_session_getfiletodirectory|''Session.GetFileToDirectory'']].
Line 44: Line 44:
===== Remarks ===== ===== Remarks =====
-Event ''[[library_session_filetransferred|Session.FileTransferred]]'' is raised for every downloaded file.+Event ''[[library_session_filetransferred|Session.FileTransferred]]'' is raised for every downloaded file. Also raises [[library_session_filetransferprogress|''Session.FileTransferProgress'']] throughout the transfer.
The download aborts on the first error. See how to [[library_example_recursive_download_custom_error_handling|implement recursive directory tree download with custom error handling]]. The download aborts on the first error. See how to [[library_example_recursive_download_custom_error_handling|implement recursive directory tree download with custom error handling]].
===== [[example]] Examples ===== ===== [[example]] Examples =====
 +
==== [[csharp]] C# Example ==== ==== [[csharp]] C# Example ====
<code csharp> <code csharp>
Line 67: Line 68:
                UserName = "user",                 UserName = "user",
                Password = "mypassword",                 Password = "mypassword",
-                SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx...="+                SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx..."
            };             };
Line 120: Line 121:
                .UserName = "user"                 .UserName = "user"
                .Password = "mypassword"                 .Password = "mypassword"
-                .SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx...="+                .SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx..."
            End With             End With
Line 170: Line 171:
        UserName = "user"         UserName = "user"
        Password = "mypassword"         Password = "mypassword"
-        SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx...="+        SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx..."
    }     }
Line 227: Line 228:
    sessionOptions.UserName = "user";     sessionOptions.UserName = "user";
    sessionOptions.Password = "mypassword";     sessionOptions.Password = "mypassword";
-    sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx...=";+    sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx...";
       
    var session = WScript.CreateObject("WinSCP.Session");     var session = WScript.CreateObject("WinSCP.Session");
Line 288: Line 289:
    .UserName = "user"     .UserName = "user"
    .Password = "mypassword"     .Password = "mypassword"
-    .SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx...="+    .SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx..."
End With End With
Line 323: Line 324:
==== Real-Life Examples ==== ==== Real-Life Examples ====
-  * [[script_download_timestamped_filename|Downloading file to timestamped-filename]]; +  * [[script_download_timestamped_filename|*]]; 
-  * [[script_download_most_recent_file|Downloading the most recent file]]; +  * [[script_download_most_recent_file|*]]; 
-  * [[library_example_recursive_search_text|Search recursively for text in remote directory / Grep files over SFTP/FTP protocol]]; +  * [[library_example_recursive_search_text|*]]; 
-  * [[library_example_recursive_download_custom_error_handling|Recursively download directory tree with custom error handling]]; +  * [[library_example_recursive_download_custom_error_handling|*]]; 
-  * [[library_example_check_existence_timestamp|Checking file existence and timestamp]]; +  * [[library_example_check_existence_timestamp|*]]; 
-  * [[extension_archive_and_download|Archive remote files to ZIP archive, download it, and optionally extract it]].+  * [[extension_archive_and_download|*]].

Last modified: by martin