Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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)


Topic review


Re: Deleting local files after successful transfer via script

Edit 2023: Just add -delete switch to the put command.
put -delete C:\import

You can run the WinSCP script from batch file that will remove the local file after the WinSCP finishes. Next version of WinSCP will maybe support execution of local commands directly.

Deleting local files after successful transfer via script

Hi, I apologize in advance if this I have missed this information somewhere, but is there a way to remove local files once they have been successfully updated via a script?

For example, right now I have a machine automatically uploading to a remote Linux server from a Windows workstation. I would like the first workstation to delete the local files once they have been uploaded, but I do not know what the command/syntax would be to accomplish this (if it exists)?

For example, on the first machine I might have something simple like this running via task scheduler:
option batch on
option confirm off
open user:user@
option transfer binary
put C:\import
%%% I would like a command to delete the files in C:\import here :) %%%

Can anyone tell me how I can accomplish this?