Post a reply

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: how to synchronize files from local to remote and delete local files in winscp

I want to delete the files from local directory once i have synchronized with remote directory.

Your duplicate post:
https://winscp.net/forum/viewtopic.php?t=7404#89863
Guest

how to synchronize files from local to remote and delete local files in winscp

I want to delete the files from local directory once i have synchronized with remote directory.

Here is my script,
#Resources Can be Found here - https://winscp.net/eng/docs/scripting 
option batch abort
option confirm off
open scp://XXX:YYY@localhost -hostkey="ZZZ"
synchronize remote -delete [local directory] [remote directory]
exit

With the above script, files are getting deleted in remote directory.

If i use the below script, then files from remote is getting synchronized to my local.
synchronize local -delete [local directory] [remote directory]

If i switch the directory then i get an error,
synchronize local -delete [remote directory] [local directory]
DWoods

Sync Files, Copy & Delete

I have set-up a script that will synchronize remote files to a local folder, and from a local folder to remote. However, what i am wanting to do is have a script that will detect any changes in the local folder such as if a file/ folder is deleted or renamed that it will synchronize with the remote folder.

I have seen script that once the file is transferred over to the remote location it will delete the file but that is not what i am after. I wish to be able to delete the file manually through windows explorer and the script update and process the rest.

the script i am using at the moment is:

.txt file
#Resources Can be Found here - https://winscp.net/eng/docs/scripting
option batch abort
option confirm off
open ftp://usrname:pwd@ftp.address/
synchronize remote [local folder] /[remote folder]
exit

.bat file
@echo off
:loop
winscp.com /script=SyncToRemote.txt
timeout /t 120
goto loop