Moving files from one remote folder to another while allowing overwriting

Advertisement

rbylnz
Joined:
Posts:
1

Moving files from one remote folder to another while allowing overwriting

I am trying to move files from one remote folder to another remote folder. I am using the mv command and it works fine. The only problem is when there are old files in the destination folder (to be more specific: duplicates of the ones in the source folder), it does not overwrite (or simply skip) those files. The file i want to move still exists in the source folder. The remaining files in the source folder (other than the one that has a duplicate in the destination) also cannot be moved because of this.
I have seen that synchronize local / remote can be used for get / put to overwrite files like this. But I could not find a solution to use for the mv command.
I also tried (instead of using the mv command) copying and then deleting the files between the remote folders, but I couldnt find a command for copyi[/code]ng files between remote folders.
Is there a way to solve this?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
32,052
Location:
Prague, Czechia

Re: Moving files from one remote folder to another while allowing overwriting

There's no simple way to solve this with WinSCP scripting.

You can replace your WinsCP script with e.g. PowerShell script with use of WinSCP .NET assembly.
https://winscp.net/eng/docs/library_from_script
https://winscp.net/eng/docs/library_powershell

With it, you can iterate the files and process then one-by-one doing any checks you need.

Reply with quote

Advertisement

You can post new topics in this forum