Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I try to delete all files from a directory on a remote FTP server with BASH. I was only able to delete the files and the folder, but not just clearing a folder out.. :/

share|improve this question
    
rm -rf * didn't work? –  qweet Jul 23 '12 at 17:03
    
Are you using an FTP client to access the remote system or SSH. Bash is simply a shell, but bash isn't used via an FTP client. –  Zoredache Jul 23 '12 at 17:10
    
rm -rf * would work on local systems, but I have to delete the files over ftp (there is no ssh). I thought to use lftp or ncftp but I am not sure which one to choose. Thanks :) –  Pay87 Jul 23 '12 at 17:12
add comment

1 Answer

From the ftp man page:

mdelete [remote-files] Delete the remote-files on the remote machine.

So you should be able to connect to your ftp server, navigate to the proper directory, and then mdelete the desired files:

ftp nobody@ftp.example.com
cd my_local_directory
prompt
mdelete *.txt~

The prompt command tells your ftp client not to ask you for a confirm each time.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.