0

I want to download only new files from one SFTP server using WinSCP.

Suppose, I have 10 files in source and destination today.
Tomorrow one new file may be added to the source. In this scenario, I want to copy the new file only into destination.

I am using below script:

open sftp_connection
cd /path
option transfer binary
get "*.txt" localpath
close
exit

By using above, I am able to copy all files, but I want only new files which are not available in destination.

Thanks,
Srikrishna.

0

1 Answer 1

0

The easiest solution is to add -neweronly switch to your get command:

get -neweronly *.txt C:\local\path\*

For a very similar results, you can also use synchronize command:

synchronize local . C:\local\path -filemask=*.txt

See also WinSCP article on Downloading the most recent file.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.