Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a problem with my infrastructure here.

I am in a closed DMZ and have to access a FTP-Server in another DMZ from a headless Suse Linux 10.1.

So i think i only got the ftp command.. But i have to delete a directory with about 100 subdirectorys and endless files in it..

When I type

del directory

it returns "Its not empty" and so i have to delete each sub directory and file manually.

Oh please tell me a way how i can do this automatically :)

share|improve this question

3 Answers 3

up vote 11 down vote accepted

Use lftp. The the -r option to lftp rm recursively deletes directories and files.

$ lftp -u <user>,<pass> <server> 
lftp> rm -r <directory>

should do the trick.

share|improve this answer
I installed lftp and now it works :) –  Fake4d Jan 12 '11 at 9:35
This works, and I'm not aware of a better option, but be advised that this is slow as it deletes each file one by one! My plan was to delete a directory and its contents on a live webserver, and then replace them, but this method is slow enough to render it ineffective for my situation. –  Tyler Collier Oct 14 '13 at 21:39
@TylerCollier there is: point the virtual host of the webserver to a symlink instead of the real directory (e.g. /var/www -> www-20141001). Then you mirror your new data into its own directory (e.g. www-20141229) and just change the symlink (cd /var/www && ln -s www-20141229 www). You get instant change of the data and the possibility to rollback your solution, should something go wrong (TDD works great with this!). –  Lars Dec 29 '14 at 10:13
Wow, great idea Lars, thanks! –  Tyler Collier Dec 30 '14 at 18:28
WOW!!! Life saver! –  felipsmartins Sep 14 at 19:59

The lftp command, which is available in many distros (though I'm no SUSE expert), supports "rm -r" for exactly that purpose.

share|improve this answer
Thanks! I installed it! –  Fake4d Jan 12 '11 at 9:36

rm -rf?

share|improve this answer
No this doesnt work in FTP! –  Fake4d Jan 12 '11 at 7:52

Your Answer


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.