Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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:

cd my_local_directory
mdelete *.txt~

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

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .