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

Advertisement

jullman
Joined:
Posts:
5

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

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.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,442
Location:
Prague, Czechia

Re: Put with Delete to move and delete all files but not folders

You have to delete the files one by one. There's no magic for that in WinSCP.

Reply with quote

Freitag
Freitag avatar
Joined:
Posts:
75

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 .)

Reply with quote

Advertisement

You can post new topics in this forum