Syncing files(mirroring). Script Stops after removing an extra files from destination.

Advertisement

peterneal
Joined:
Posts:
1

Syncing files(mirroring). Script Stops after removing an extra files from destination.

When syncing files (mirror files) from a server to win10 local machine client the script stops. It’s encountering a problem removing extra files from client. Here is the script…
# automatically abort script on errors
Option batch abort
# Disable overwrite confirmations that conflict with the previous
Option confirm off
# Open
Open %2% -certificate=* -rawsettings Compression=1
Synchronize local -transfer=binary -mirror -criteria=either -filemask="|log.txt; Thumbs.db; desktop.ini" "%1%" "/Sesame Template" -delete
# Disconnect
Close
# Exit WinSCP
Exit

The local folder has some extra folders files that needs to be removed. (They have been copied in by a developer for testing). The script is to clean then files for the developer.
WinSCP seems to know the files need deleting and tries to delete them. But it stops the script with an error code:2. What’s interesting is the file does get deleted on the local machine, so it cannot be a Permissions thing. But the script stops anyway. If I run the script again it stops on the next file in the folder that needs deleting..
Does it look like it’s trying to delete the file twice? Any ideas as to the problem?
Here is a log file snippet…
2019-02-07 17:50:58.825 Script: Synchronizing...
. 2019-02-07 17:50:58.826 Synchronizing local directory 'c:\sesame\Companions\Plugins\MonitorChart\' with remote directory '/Sesame Template/Companions/Plugins/MonitorChart/', params = 0x1403 (Delete, NoConfirmation, BySize, Mirror)
< 2019-02-07 17:50:58.828 Script: Local 'c:\sesame\Companions\Plugins\MonitorChart' <= Remote '/Sesame Template/Companions/Plugins/MonitorChart'
< 2019-02-07 17:50:58.828 Script: 'c:\sesame\Companions\Plugins\MonitorChart\DevExpress.Office.v18.1.Core.dll' deleted
. 2019-02-07 17:50:58.829 Synchronizing local directory 'c:\sesame\Companions\Plugins\MonitorChart\' with remote directory '/Sesame Template/Companions/plugins/MonitorChart/', params = 0x1403 (Delete, NoConfirmation, BySize, Mirror)
< 2019-02-07 17:50:58.834 Script: Error deleting file 'c:\sesame\Companions\Plugins\MonitorChart\DevExpress.Office.v18.1.Core.dll'.
< 2019-02-07 17:50:58.834 System Error. Code: 2.

Pete.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
31,635
Location:
Prague, Czechia

Re: Syncing files(mirroring). Script Stops after removing an extra files from destination.

That looks strange. Can you delete (not recycle) those files from WinSCP GUI? Don't you have a similar problem when deleting them using other tools? Like command-line del command?

Reply with quote

Guest

Re: Syncing files(mirroring). Script Stops after removing an extra files from destination.

The failing script is being run on the local win10 machine.
I can use the command line "del" to remove the files.
I've turned off "Preferences > Environment > Moving files to recycle bin" and I can remove the files on the local win10 machine using the WinSCP UI on the win10 machine.
I seem to be able to remove the files ok in all sorts of other ways.
In fact, the WinSCP script can remove the file. After the script fails and stops I check the file and it has gone. If I run the script again it fails on the next file. So it would seem being able to remove the file(s) in the first instance is not the issues.

I'm not that familiar with the logs, but does the log look like it's trying to delete it twice to you? First time successful and fails the seconds because it's already gone.

I’m a little new to the logs so cannot quite figure out higher up in the log if it's be catalogued twice for deletion. I can't attach the full log, the web page attachments is not working, it tells me I'm attaching an empty file every time. I’m happy PM(or other) full log.

Thanks for your help, this has really got me scratching my head.

Reply with quote

Guest

Re: Syncing files(mirroring). Script Stops after removing an extra files from destination.

Found the issue. :-)

On the Linux server, the "\sesame\Companions\Plugins" folder was listed twice as
\sesame\Companions\Plugins
\sesame\Companions\plugins
This is due to an error in the FTP servers virtual folder structure and the case of the "P"

Beacuse windows OS is not case sensitive on folder names, WinSCP was syncing both server folders "\sesame\Companions\Plugins" and "\sesame\Companions\plugins" to the one folder on in the windows machine. Resulting in the double delete in the Win10 OS. It was trying to remove the same files twice because windows ignored the folder's name case. This failed.

Fixing the Linux server folder structure solved the issue.

Thanks again for your help.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
31,635
Location:
Prague, Czechia

Re: Syncing files(mirroring). Script Stops after removing an extra files from destination.

Thanks for sharing your findings!

Reply with quote

Advertisement

You can post new topics in this forum