Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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 Not to Overwrite

You cannot implement this exact custom logic with simple WinSCP scripting.
You would have to use a more powerful script. You can use PowerShell with WinSCP .NET asssembly.
Here is an example of similar script (in an opposite direction):
Deleting remote files after successful remote to local synchronization
fang

Script Not to Overwrite

Thanks Martin,
I tried this however once the file has been copied it leaves the file in its original location. What I am trying to do it:

  • File Amsurv_Enterprise.txt in remote location.
  • Check if file Amsurv_Enterprise.txt already exists on local location.
  • If file already exists in local location then do not move file from remote directory and exit.
  • If the file does not exist in local directory the move file from remote directory to local directory and exit (Move so that once copied from the remote directory to local directory, the file is deleted from the remote directory so it only exists in the local directory.).

Many Thanks for your help.

Andy
fang

Script Not to Overwrite

Hi All,
I and trying to configure a script to move a file from one location to another. If the file already exists in the destination location for the copy not to take place leaving the source file where it is. E.g. Do not move file if file already exists in destination location.

This is my current script:
open ftpes://**/ -certificate="**" 
 
cd /COSURV
lcd Q:\COSURV
 
get -delete Cosurv_Enterprise.txt
 
exit
 
# Execute the script using a command like:
# "C:\Program Files (x86)\WinSCP\WinSCP.exe" /log="C:\writable\path\to\log\WinSCP.log" /ini=nul /script="C:\path\to\script\script.txt"