Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Script - Check if file exists on local drive before downloading

Do I understand right, that you want to download a file only, if it does not exist already in a different folder than the download/destination folder?

There's no easy way to do this in WinSCP scripting.

But if you use WinSCP .NET assembly from a full-featured language, like PowerShell, it's trivial.

For some example, see:
https://winscp.net/eng/docs/library_example_check_existence_timestamp#powershell
You will just want to test the "processed" folder instead of the downloaded folder in the:
if (!(Test-Path $localPath))
Vanik

Script - Check if file exists on local drive before downloading

Hi,

Currently have a Batch file which downloads .CSV files from my SFTP to local file fine.
After handling the .CSV, it gets moved to a "processed" file.

I would ask if it is possible to add the the batch script which checks if the file exists locally in the "processed" file, before enable downloading from the SFTP site to the oringal file location.

Many thanks.