Recursive get and delete files (but not the directories !)
Hi,
I have a FTP server with the following directories:
Within each directory, I may have one or more file named
I wanted to write a WinSCP command to retrieve all files and then delete them, but without trying to delete the directories.
I first tried with this:
If I don't use
I then tried with multiple filemask combination without success:
WinSCP always tries to remove directories :(
Any way to achieve this? I've seen in an old post that recursive delete was not supported by WinSCP in 2012:
Automatic delete files or folders matching a search term
but maybe today... ? :D
Thanks!
I have a FTP server with the following directories:
/OUT/DIR1/ /OUT/DIR2/ /OUT/DIR3/
FILExxxxxxx.txt
.
I wanted to write a WinSCP command to retrieve all files and then delete them, but without trying to delete the directories.
I first tried with this:
WinSCP.com /command "option batch abort" "option confirm off" "open SESSION" "cd /OUT/" "get -transfer=binary -delete -filemask=FILE*.txt * .\" "close" "exit"
-delete
option, it works, however, with the -delete
option, it fails as it try to delete /OUT/DIR1
(and the user has no right for this hopefully).
I then tried with multiple filemask combination without success:
WinSCP.com /command "option batch abort" "option confirm off" "open SESSION" "cd /OUT/" "get -transfer=binary -delete -filemask=/OUT/*/FILE*.txt * .\" "close" "exit" WinSCP.com /command "option batch abort" "option confirm off" "open SESSION" "cd /OUT/" "get -transfer=binary -delete -filemask=FILE*.txt;/OUT/*/ *" "close" "exit" WinSCP.com /command "option batch abort" "option confirm off" "open SESSION" "cd /OUT/" "get -transfer=binary -delete -filemask=/OUT/*/FILE*.txt *" "close" "exit"
Any way to achieve this? I've seen in an old post that recursive delete was not supported by WinSCP in 2012:
Automatic delete files or folders matching a search term
but maybe today... ? :D
Thanks!