View the Most Wanted LQ Wiki articles.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-21-2003, 10:22 AM   #1
LQ Newbie
Registered: Apr 2003
Location: wollongong, australia
Distribution: red hat
Posts: 28

Rep: Reputation: 15
deleting non-empty directory


how to remove/delete a directory which is not empty, without first emptying the directory. like i mean in one go, with a single command.
Old 04-21-2003, 10:31 AM   #2
LQ Guru
Registered: Jan 2001
Posts: 24,147

Rep: Reputation: 229Reputation: 229Reputation: 229
rm -rf /directory

Be careful, this can be dangerous, if you accidently leave a space between the / and name of the directory, you will delete everything on your system.

Also a search would have found this as its asked all the time with replies.
Old 04-21-2003, 10:29 PM   #3
Registered: Oct 2002
Location: Northern Ontario, Canada
Distribution: Slackware 10.0
Posts: 789

Rep: Reputation: 30
I think you'd be better off typing the following:

man rmdir

You should take not of the --ignore-on-non-empty or whatever the option is (I'm not at my Slackbox to give you the proper option, but if you read the man page, you'll find what you're looking for--and it's harder to delete your whole system with the rmdir command).

Hope this helps.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
rm: cannot remove directory `ff': Directory not empty blancs Linux - General 17 08-29-2011 02:47 PM
Deleting empty line at end of text file in BASH human2.0 Linux - General 8 04-01-2009 03:44 AM
"WARNING: Circular directory structure" error when deleting directory pistonbrew Linux - Software 5 02-03-2005 07:05 AM
ProFTPD - deleting non-empty directories? orange400 Linux - Software 1 05-28-2004 04:36 AM
Mounting a non-empty directory MasterBean Linux - General 1 07-12-2001 11:34 PM

All times are GMT -5. The time now is 02:08 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration