Have batch script as follows:
>>ftp.txt open ftp.site.com
>>ftp.txt username
>>ftp.txt password
>>ftp.txt directoryname
>>ftp.txt quit
ftp -s ftp.txt
How can I delete all files in folder 'directoryname'?
To delete files on the FTP server use the delete command. To delete several files at once, use the mdelete command. You will be asked to provide a “y” or “n” confirmation for the deletion of each file. Here our FTP user has listed the files to see their names and then chosen one to delete.
FTP command line window instructionsUse the lrmdir command to remove an empty directory from your PC and the rmdir/xrmdir command (from the command line window only) to remove an empty directory from the FTP server.
Using the -r flag to deleting a non-empty directory. If you do not want a prompt before deleting the directory and its contents, use the -rf flag. This will remove everything inside the directory, including the directory itself, without any confirmation.
Put the following commands in ftp.txt and run as follows to accomplish this task:ftp -i -s:ftp.txt
contents of ftp.txt:
open ftp.site.com
username
password
cd directoryname
mdelete *
quit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With