Topic "Automation: Get -delete function on multiple files"

Author Message


I have script today that pulls all files off an SFTP folder down to a local drive. A request has been made to have the files deleted after download. I have read the help and I see that the get -delete function should do exactly what I want, however I do not see how this operation works when the get is pulling multiple files.

Today the command is:
get /In/*ABC* C:\Files\In\

So, in theory, I can change that to:
get -delete /In/*ABC* C:\Files\In\

But, will the job delete each file as it is downloaded, might it delete files it has yet to download, or will it wait until the last file is downloaded to start deleting? The only other way I see to do this is to leave the original get in place, exit the connection, read the files in the C:\Files\In\ folder, then delete each of the files specifically by name.

[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26858
Location: Prague, Czechia
It dowloads the first file, deletes the first file, downloads the second file, deletes the second file, and so on.
Martin Prikryl


Thanks for the response.

You can post new topics in this forum


What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License