LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

Reply
 
Search this Thread
Old 06-01-2005, 12:07 AM   #1
newuser455
Member
 
Registered: May 2004
Location: Texas
Posts: 277

Rep: Reputation: 30
Remove directory and sub directories


How can I remove a directory and sub directory?

This is what happens when I use rm -r

Code:
[root@server main]# rm -r dir
rm: descend into directory `dir/ASP'? y
rm: descend into directory `dir/CGI'?
How can I force all of the directories to be deleted?
 
Old 06-01-2005, 12:13 AM   #2
cash_05
LQ Newbie
 
Registered: Sep 2003
Posts: 12

Rep: Reputation: 0
user rm -fr

type rm --help for more detail, f means force i think, so the system wont ask whether to delete or not.

cheers
 
Old 06-01-2005, 12:14 AM   #3
Mega Man X
Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 63
Try "rm -rf <directory>". Using the f flag you won't be asked if you are sure about deleting the directory/sub directories. Use it carefully

Regards!

Last edited by Mega Man X; 06-01-2005 at 12:17 AM.
 
Old 06-01-2005, 12:16 AM   #4
newuser455
Member
 
Registered: May 2004
Location: Texas
Posts: 277

Original Poster
Rep: Reputation: 30
Thanks. I've been just typing "y" for every one. lol. One thing I just never learned in my 1 1/2 years with linux so far...
 
Old 06-01-2005, 12:27 AM   #5
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
Quote:
Originally posted by newuser455
Thanks. I've been just typing "y" for every one. lol. One thing I just never learned in my 1 1/2 years with linux so far...
Its probably good you never learnt it as a newbie. Its a very good command, but also very dangerous.
 
Old 06-01-2005, 12:31 AM   #6
newuser455
Member
 
Registered: May 2004
Location: Texas
Posts: 277

Original Poster
Rep: Reputation: 30
No, I regret that I never learned it... what I have been using is just as bad. Once I thought my website was backed up, so I spent a few minuted saying "y" to everything, later to find out that I did not have it backed up... I think that tought me a good enough lesson Yeah, I'm pretty careful now.

P.S. Yay, this is my 100th post. lol

Last edited by newuser455; 06-01-2005 at 12:32 AM.
 
  


Reply


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 01:47 PM
Remove directories recursively with same name cboyd Linux - Newbie 5 01-14-2007 09:48 PM
shell script: delete all directories named directory.# except directory.N brian0918 Programming 3 07-13-2005 06:54 PM
how do I remove all empty directories? noisybastard Linux - General 2 08-10-2003 11:47 PM
How to remove directories? jameshao Linux - Newbie 2 09-13-2001 02:54 PM


All times are GMT -5. The time now is 03:45 AM.

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