Differences

This shows you the differences between the selected revisions of the page.

2013-08-02 2015-10-13
favout .net for this task (martin) -delete and -newer only (martin)
Line 12: Line 12:
If it can happen that the same file is both in source and destination folder, you can use synchronization and delete only transferred files afterward. If it can happen that the same file is both in source and destination folder, you can use synchronization and delete only transferred files afterward.
-You can implement this easily using [[library|WinSCP .NET assembly]]. See example [[library_example_delete_after_successful_download|Deleting remote files after successful remote to local synchronization]].+A simple way to implement this is using both ''-delete'' and ''-neweronly'' switches of the ''[[scriptcommand_put|put]]'' (or ''[[scriptcommand_get|get]]'') command 
 + 
 +If you need more control (like if you want to delete the files only after all of them are transferred successfully), you can implement this easily using [[library|WinSCP .NET assembly]]. See example [[library_example_delete_after_successful_download|Deleting remote files after successful remote to local synchronization]].
If you do not want to use .NET assembly: Perform the synchronization using ''[[scriptcommand_synchronize|synchronize]]'' command. Make sure the script generates [[logging_xml|XML log file]]. You can then [[logging_xml#parse|parse]] the log file to enumerate files that got successfully transferred, and use the list, to generate script to delete the source copies. If you do not want to use .NET assembly: Perform the synchronization using ''[[scriptcommand_synchronize|synchronize]]'' command. Make sure the script generates [[logging_xml|XML log file]]. You can then [[logging_xml#parse|parse]] the log file to enumerate files that got successfully transferred, and use the list, to generate script to delete the source copies.

Last modified: by martin