Delete files on automatic syncronization?

Advertisement

nbr_uk
Joined:
Posts:
1

Delete files on automatic syncronization?

Hi all, I've automated syncronization using information I found in his thread https://winscp.net/forum/viewtopic.php?t=4181 (thanks Prikryl) and it works a treat - I just need to adjust my script to delete files from the local directory when they no longer exist in the remote directory. It currently reads as follows:

open stored_session
synchronize local [local docs] [docs on server]

Is there a switch I can add to facilitate this? Hope someone can help.

Thanks, nbr_uk

Reply with quote

Advertisement

Guest

prikryl ... I'm not seeing a delete option on the link you gave.

My situation is a little different than nbr_uk's. I'm needing to delete local files after being moved to a remote destination.
In the synchronize dialog box I have:
Direction = Remote
Mode = Synchronize Files
Options = Delete Files, Preview Changes
Comparison Criteria = Modification Time

How do I get the local files to be deleted once moved?

Thanks!!!

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Anonymous wrote:

I may have just found the answered to my question, but would like confirmation.

On https://winscp.net/eng/docs/faq_delete_synchronized_files it says "..to generate script to delete the source copies" The way this sounds, WinSCP cannot delete these files on its own.
Depends on what you want. If you want what nbr_uk asked for, WinSCP can do that:
https://winscp.net/eng/docs/scriptcommand_synchronize

The FAQ is about different task.
_________________
Martin Prikryl

Reply with quote

KennethW
Guest

Delete Local Files or Return Error Code on Connection failed

Hello - I have a similar issue where I either would like to have WinSCP return an error code on connection failed (it currently returns zero) or be able to delete local files from within WinSCP script after putting successfully to the remote server. I am calling the WinSCP command line version from a batch file using a WINSCP script.

Is this possible ?

Thanks,
KennethW

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: Delete Local Files or Return Error Code on Connection failed

KennethW wrote:

Hello - I have a similar issue where I either would like to have WinSCP return an error code on connection failed (it currently returns zero)
Are you using the latest version of WinSCP. The latest version should return 1 on any error.
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum