UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old November 20th, 2003, 02:14 AM
tzeyik tzeyik is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 22 tzeyik User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
problem of removing subdirectory of a directory

I find out cannot remove the directory that contain file and another subdirectory by using command

rmdir -f dir_name

so, everytime i hv to clear out the content of directory in order to delete the directory. So, anyone can teach me how to solve this problem? thanks~

Reply With Quote
  #2  
Old November 20th, 2003, 11:42 AM
druuna druuna is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 137 druuna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 37 sec
Reputation Power: 0
rm has this option. See man rm for all options

rm -rf dir_name

-r, -R, --recursive
remove the contents of directories recursively

-f, --force
ignore nonexistent files, never prompt

A warning: linux (and unix) are relentless, they do what you ask and don'y ask if you are sure!

Reply With Quote
  #3  
Old November 20th, 2003, 06:35 PM
tzeyik tzeyik is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 22 tzeyik User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
druuna, thanks again~
I am a beginner of Unix OS, so i still not familiar with those command..
By the way, u r a very good tutor for me~ Have a nice day!

Reply With Quote
  #4  
Old December 6th, 2003, 11:28 PM
jayakhanna jayakhanna is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: India
Posts: 61 jayakhanna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
One small addition, You need to use "rm -rf" cautiously, if you tend to give "rm -rRf" * then the whole of the files from the root directory will be gets deleted. You better give rm -ri rather than rm -rf

-i option will ask for confirmation before deleting the files
__________________
Regards
JK

Reply With Quote
  #5  
Old December 7th, 2003, 01:09 AM
mttatkns mttatkns is offline
Got source?
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Mar 2003
Location: Laguna Niguel, California, USA
Posts: 2,332 mttatkns User rank is Private First Class (20 - 50 Reputation Level)mttatkns User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
It will ask for confirmation if you don't include -i or -f. If you know what you are doing, -f is a better solution especially if you have a lot of files, as it would be very annoying to have to say yes many times needlesly.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > problem of removing subdirectory of a directory


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway