Differences
This shows you the differences between the selected revisions of the page.
| library_example_remember_downloaded_files 2019-07-16 | library_example_remember_downloaded_files 2022-06-16 (current) | ||
| Line 1: | Line 1: | ||
| ====== Remember already downloaded files so they are not downloaded again ====== | ====== Remember already downloaded files so they are not downloaded again ====== | ||
| - | You might have a server, where some kind of data files are periodically generated. You need to regularly download a new set of files to the local machine, where the files are processed. If you keep local copies of the files, you can use a simple [[task_synchronize_full|synchronization]]. But if you cannot keep the local copies, you will have to remember, what files did you download already. And this is, what this script does. | + | You might have a server, where some kind of data files are periodically generated. You need to regularly download a new set of files to the local machine, where the files are processed. If you keep local copies of the files, you can use a simple [[task_synchronize_full|synchronization]]. But if you cannot keep the local copies, you will have to remember, what files did you download already. And this is, what this script does. An alternative is to [[faq_script_modified_files#last_timestamp|remember a timestamp of the last transferred file]]. |
| You can install this script as an [[extension|WinSCP extension]] by using this page URL in the //[[ui_pref_commands#extensions|Add Extension]]// command. The extension will automatically use the current local and remote directories. | You can install this script as an [[extension|WinSCP extension]] by using this page URL in the //[[ui_pref_commands#extensions|Add Extension]]// command. The extension will automatically use the current local and remote directories. | ||
| Line 6: | Line 6: | ||
| To run the script manually or to [[guide_schedule|schedule it]], use: | To run the script manually or to [[guide_schedule|schedule it]], use: | ||
| - | <code batch> | + | <code> |
| - | powershell.exe -File C:\path\DownloadNewFiles.ps1 -sessionUrl "sftp://username:password;fingerprint=ssh-rsa-xx-xx-xx@example.com/" -localPath "C:\local\dest" -remotePath "/remote/source" -listPath "C:\path\downloaded.txt" | + | powershell.exe -File C:\path\DownloadNewFiles.ps1 -sessionUrl "sftp://username:password;fingerprint=ssh-rsa-xxxxxxxxxxx...@example.com/" -localPath "C:\local\dest" -remotePath "/remote/source" -listPath "C:\path\downloaded.txt" |
| </code> | </code> | ||
| Line 32: | Line 32: | ||
| param ( | param ( | ||
| # Use Generate Session URL function to obtain a value for -sessionUrl parameter. | # Use Generate Session URL function to obtain a value for -sessionUrl parameter. | ||
| - | $sessionUrl = "sftp://user:mypassword;fingerprint=ssh-rsa-xx-xx-xx@example.com/", | + | $sessionUrl = "sftp://user:mypassword;fingerprint=ssh-rsa-xxxxxxxxxxx...@example.com/", |
| [Parameter(Mandatory = $True)] | [Parameter(Mandatory = $True)] | ||
| $localPath, | $localPath, | ||
| Line 144: | Line 144: | ||
| ===== [[options]] Options ===== | ===== [[options]] Options ===== | ||
| + | |||
| ==== Run time ==== | ==== Run time ==== | ||
| The first two input boxes specify source remote and destination local folder. These will be filled with paths to the current remote and local directories. | The first two input boxes specify source remote and destination local folder. These will be filled with paths to the current remote and local directories. | ||