Delete files at local if deleted from remote

Advertisement

clyded
Joined:
Posts:
3

Delete files at local if deleted from remote

Hi there,

I was wanting to achieve the following, could you please enlighten me?

Future
I'm wanting to sync local (target) directory with remote (source) directory. So:
[1] any files updated at remote should get downloaded to my local directory after the sync
[2] any files deleted at remote should get deleted in my local directory after the sync
[3] any files added at remote should get added to my local directory after the sync

Current
At the moment, with the code below, I'm getting [1] and [3] from the list above.
option batch abort
option confirm Off
open sftp://username:password@server -hostkey="ssh-rsa 2048 mac-address"
synchronize local local-directory remote-directory -filemask="|*.*_"
exit

How do I achieve Future scenario #[2]? I've read about using the
-delete

option, would that achieve the end result?

Potential update to the code?
synchronize local local-directory remote-directory -filemask="|*.*_" -delete

Thanks,
Clyde

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,285
Location:
Prague, Czechia

Re: Delete files at local if deleted from remote

clyded wrote:

Potential update to the code?
synchronize local local-directory remote-directory -filemask="|*.*_" -delete
That's correct.

Reply with quote

Advertisement

You can post new topics in this forum