rmdir a non-empty directory. | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

rmdir a non-empty directory.

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-10-2002
yls177
Guest
 
Posts: n/a
rmdir a non-empty directory.

hi, i understand that rmdir will only remove direcotry when it is empty but are there options which will also remove non-empty directories? i went to man rmdir but only find the option -p? i am on solaris. thanks
Sponsored Links
    #2  
Old 12-10-2002
TioTony's Avatar
TioTony TioTony is offline Forum Advisor  
Bit Pusher
 
Join Date: Oct 2001
Last Activity: 6 April 2014, 6:16 PM EDT
Location: Southern California
Posts: 332
Thanks: 0
Thanked 1 Time in 1 Post
You could use rm -R instead. This will remove the directory as well as any files and subdirectories as long as they are not in use. Be carefull though, make sure you specify the correct directory or you can remove a lot of stuff quickly.
Sponsored Links
    #3  
Old 12-11-2002
indo1144's Avatar
indo1144 indo1144 is offline
Registered User
 
Join Date: Jun 2002
Last Activity: 20 September 2012, 9:22 AM EDT
Location: Netherlands
Posts: 54
Thanks: 0
Thanked 2 Times in 2 Posts
Re: rmdir a non-empty directory.

You could also do a:

rm -rf <target>

The -r and -R (see previous reply from TioTony) parameter are the same and will make it recursively travel down any subdirectory it finds.
The -f makes sure you are not prompted for confirmation (handy if there are lots of files and directories inside the target-directory).

Same warning applies here... Be careful when using this. Re-read your commandline and make sure you're in the right directory!

Most of the time, when using a powerful command like this, I use the full path + directoryname, just to be sure.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
check empty directory !!! allah_waris45 Shell Programming and Scripting 2 06-01-2009 11:38 PM
check whether the directory is empty or not KiranKumarKarre Shell Programming and Scripting 8 06-01-2009 05:06 AM
How do I tell if a directory is empty? KenJackson Shell Programming and Scripting 6 12-31-2008 08:35 AM
How to empty all files in a directory majormark Shell Programming and Scripting 9 07-21-2008 04:35 PM
Setting the right directory as non-empty olimiles Shell Programming and Scripting 0 08-31-2006 10:31 AM



All times are GMT -4. The time now is 07:15 PM.