Copy ONLY New Files from Remote Server to Local Server without checking the Timestamp
I hope someone can help with this. Using batch scripting with WinSCP, I am trying to copy ONLY NEW FILES from a remote SFTP server to my local server.
The problem I am having is the timestamp changes on files on the remote server on All files <=5 days. (Their process will not change)
So I get a combination of new files and files that already existed on my local drive, but just have a different timestamp.
I would like to copy ONLY files that are New and doesn't exist in MyLocalFolder when compared to TheirRemoteFolder.
I've tried the WinSCP
The script command I ran is the following:
With that script, I get new files, but I also get files that I already have because the modified or created timestamp differs.
Can anyone suggest code within the WinSCP scripting that can copy ONLY the new files where?
I'm not trying to use any other code to do this, as that would bring in other issues. Just trying to complete this using just a batch file and a WinSCP scripting text file.
The problem I am having is the timestamp changes on files on the remote server on All files <=5 days. (Their process will not change)
So I get a combination of new files and files that already existed on my local drive, but just have a different timestamp.
I would like to copy ONLY files that are New and doesn't exist in MyLocalFolder when compared to TheirRemoteFolder.
I've tried the WinSCP
synchronize
command, but that seems to have 2 criteria of (1) New Files and (2) Files with newer timestamps. I want to exclude copying files based on the timestamp since the remote location keep changing the timestamp of their files.
The script command I ran is the following:
option batch abort option confirm off open sftp://ServerConnectInfo/ -hostkey="PasswordKeyStuff" synchronize local "C:\MyLocalFolder" "/TheirRemoteFolder" exit
Can anyone suggest code within the WinSCP scripting that can copy ONLY the new files where?
I'm not trying to use any other code to do this, as that would bring in other issues. Just trying to complete this using just a batch file and a WinSCP scripting text file.