Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
google site



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 !!

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-10-2002
yls177
Guest
 

Posts: n/a
Bits: 0 [Banking]
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
Location: Southern California
Posts: 332
Thanks: 0
Thanked 0 Times in 0 Posts
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.
  #3  
Old 12-11-2002
indo1144's Avatar
Registered User
 

Join Date: Jun 2002
Location: Netherlands
Posts: 54
Thanks: 0
Thanked 0 Times in 0 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

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
remove empty directory sirrtuan Shell Programming and Scripting 7 04-09-2009 12:41 AM
Script to remove all empty files within the directory structure? cat123 Shell Programming and Scripting 5 06-05-2008 09:01 AM
deleting empty files in a directory berlin_germany Shell Programming and Scripting 5 01-26-2007 02:47 PM
Setting the right directory as non-empty olimiles Shell Programming and Scripting 0 08-31-2006 10:31 AM
How to ufsrestore to a different machine, empty directory joekerr Solaris 1 07-22-2005 10:46 AM



All times are GMT -4. The time now is 07:50 AM.