Topic "Put with Delete to move and delete all files but not folders"

Author Message
[View user's profile]

Joined: 2011-12-15
Posts: 5
I would like to PUT all files in a folder/subfolder structure to the remote site, and then delete all the files, but not the folder structure. So far I've been able to PUT everything and delete everything, but have not yet figured out how to keep the folder structure intact.

Any help would be appreciated.
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24736
Location: Prague, Czechia
You have to delete the files one by one. There's no magic for that in WinSCP.
Martin Prikryl
[View user's profile]

Joined: 2007-10-25
Posts: 51
Assuming your file source is unix...

After you have copied the files, run a remote command

The "type -f" filter will limit the results to files

find /path/to/root/file/source -type f -exec rm {}\;

find is a recursive command and it will delete EVERY file under the path you name (so don't use / or .)

You can post new topics in this forum

Search Site

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