Post a reply

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)


Topic review


Re: How to automate downloading and deleting files form remote server

@Moaen: The option is to synchronize removal of the remote files to the local directory. So it does not do what you want.

If you want to remove the new files from the remote directory, you will have to modify the code. Quick solution is to add this after the $difference.Resolve call, when the action is DownloadNew (or DownloadUpdate, although it should not occur in your set up):

How to automate downloading and deleting files form remote server

I am using Keep Local Directory to update function to watch for the changes on the remote directory and reflect them to the local drive.

Under the options, I clicked on Delete files. But the files still appears on the remote server after the download.

Am I doing something wrong?

Re: delete files on remote server

I'm not sure what you mean by "get the files on the remote server". Did you mean "delete"?
You might be looking for this:
get -delete * A:\Shares\Ochin-ReportingWorkBench\

(i.e. add the -delete to your first get command)

Delete files on remote server

Hello I have written the following script to get files from the remote server and copy them to our local server, this is working fine. Now I want to also get the files on the remote server after they have been copied, but my get -delete isn't working, could someone help me modify my script please.
# Connect
open sftp:...
# Change remote directory
cd /SA223/PHI/RWB
# Download file to the local directory A:\Shares\Ochin-ReportingWorkBench
get * A:\Shares\Ochin-ReportingWorkBench\
# Delete Remote Files (here is the problem)
get -delete * .\
# Disconnect
# Exit WinSCP