Unix/Linux Go Back    

UNIX for Dummies Questions & Answers This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in this forum UNIX for Beginners Questions & Answers

rmdir a non-empty directory.

UNIX for Dummies Questions & Answers

Thread Tools Search this Thread Display Modes
Old Unix and Linux 12-10-2002   -   Original Discussion by yls177
yls177's Unix or Linux Image
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
Old Unix and Linux 12-10-2002   -   Original Discussion by yls177
TioTony's Unix or Linux Image
TioTony TioTony is offline Forum Advisor  
Bit Pusher
Join Date: Oct 2001
Last Activity: 25 December 2016, 8:03 PM EST
Location: Southern California
Posts: 348
Thanks: 0
Thanked 3 Times in 3 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.
Sponsored Links
Old Unix and Linux 12-11-2002   -   Original Discussion by yls177
indo1144's Unix or Linux Image
indo1144 indo1144 is offline
Registered User
Join Date: Jun 2002
Last Activity: 19 January 2016, 8:57 AM EST
Location: Netherlands
Posts: 56
Thanks: 1
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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-02-2009 12:38 AM
check whether the directory is empty or not KiranKumarKarre Shell Programming and Scripting 8 06-01-2009 06:06 AM
How do I tell if a directory is empty? KenJackson Shell Programming and Scripting 6 12-31-2008 09:35 AM
How to empty all files in a directory majormark Shell Programming and Scripting 9 07-21-2008 05:35 PM
Setting the right directory as non-empty olimiles Shell Programming and Scripting 0 08-31-2006 11:31 AM

All times are GMT -4. The time now is 06:44 PM.