LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 03-03-2003, 12:12 PM   #1
OrganicX
Member
 
Registered: Aug 2002
Posts: 105

Rep: Reputation: 15
How can i delete Directories and Subdirectories?


Red Hat 7.3
GNOME


I would like to delete a bunch of directories and subdirectories none of which are empty.

Is there a command I can use to delete a directory even though it is not empty?
 
Old 03-03-2003, 12:34 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
rm -rf
 
Old 03-03-2003, 12:36 PM   #3
skidhmor
Member
 
Registered: Feb 2003
Location: Maitland, FL, USA
Distribution: Gentoo
Posts: 38

Rep: Reputation: 15
Pass the -r (-r stands for recursive) argument to rm.
But use with care, typing rm -rf /
as root will delete your entire partition, all mounted patitions, and, some say, your partition table.
 
Old 03-03-2003, 01:53 PM   #4
OrganicX
Member
 
Registered: Aug 2002
Posts: 105

Original Poster
Rep: Reputation: 15
thanks, that works great
 
Old 03-03-2003, 07:15 PM   #5
iceman47
Senior Member
 
Registered: Oct 2002
Location: Belgium
Distribution: Debian, Free/OpenBSD
Posts: 1,123

Rep: Reputation: 47
Quote:
Originally posted by skidhmor
But use with care, typing rm -rf /
as root will delete your entire partition, all mounted patitions, and, some say, your partition table.
I don't think rm -rf could delete the partition table
 
Old 03-03-2003, 09:36 PM   #6
skidhmor
Member
 
Registered: Feb 2003
Location: Maitland, FL, USA
Distribution: Gentoo
Posts: 38

Rep: Reputation: 15
Quote:
Originally posted by iceman47
I don't think rm -rf could delete the partition table
I don't either, but I read it somwhere, and, as I have no intention of trying it myself, I have no way of verifying that it cannot.
 
Old 03-03-2003, 09:53 PM   #7
newbieME
Member
 
Registered: Mar 2003
Location: BC Canada
Distribution: Slack Niner ;)
Posts: 185

Rep: Reputation: 30
i dare you..try -rf in root..come on!! :P
 
Old 03-03-2003, 10:09 PM   #8
cuckoopint
Member
 
Registered: Feb 2003
Distribution: Debian
Posts: 797

Rep: Reputation: 30
wouldn't -r be enough? then, when you get warnings if you're doing this recursively on something you really should'nt...makes you think twice... after this, if you still need to, you can rerun it with -rf. But for most operations, -r should be enough, eh?
 
Old 03-03-2003, 10:29 PM   #9
iceman47
Senior Member
 
Registered: Oct 2002
Location: Belgium
Distribution: Debian, Free/OpenBSD
Posts: 1,123

Rep: Reputation: 47
Quote:
Originally posted by newbieME
i dare you..try -rf in root..come on!! :P
We used to tell guys at school deltree /y *.*
(or something like that, it's been too long ) would bring up a real cool game
 
Old 03-04-2003, 12:10 AM   #10
watashiwaotaku7
Member
 
Registered: Oct 2002
Location: wisconsin -- The Badger state
Distribution: gentoo
Posts: 654

Rep: Reputation: 30
i always think its funny to go to a friends XP computer go into a dos prompt and create a file the sais "im stupid cuz i cant delete this and i use XP" in their desktop im not sure how to do it anymore so that they cant delete it from within windows but one of these days im gonna look it up cuz my friends got a 2.8 ghz p4 with 21 inch trinitron monitor and all the works and im severely jelaous...ill get him
 
Old 03-04-2003, 08:08 AM   #11
newbieME
Member
 
Registered: Mar 2003
Location: BC Canada
Distribution: Slack Niner ;)
Posts: 185

Rep: Reputation: 30
Quote:
Originally posted by watashiwaotaku7
im severely jelaous...ill get him
If you can't get a better computer, you can always burn down his house That will teach him not to buy better computers than you
 
Old 03-04-2003, 04:25 PM   #12
watashiwaotaku7
Member
 
Registered: Oct 2002
Location: wisconsin -- The Badger state
Distribution: gentoo
Posts: 654

Rep: Reputation: 30
ive thought about ti...
but i have a better idea...since we both have dimension 8200 i can swap out any and all hardware...so im thinking next time he asks me for help ill just steal his geforece4 ti 4600...some ram...probly just switch the mobos since mine doesnt have support for 1.1 extra ghz but ill leave him his hdd...hed notice that difference...then ill burn down his house for having the monitor
 
Old 03-04-2003, 06:04 PM   #13
newbieME
Member
 
Registered: Mar 2003
Location: BC Canada
Distribution: Slack Niner ;)
Posts: 185

Rep: Reputation: 30
Good Plan get a photo of his house burning down..and then we can send it to MasterC...maybe he can host it for us
 
Old 03-05-2003, 02:07 AM   #14
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Quote:
Originally posted by cuckoopint
wouldn't -r be enough? then, when you get warnings if you're doing this recursively on something you really should'nt...makes you think twice... after this, if you still need to, you can rerun it with -rf. But for most operations, -r should be enough, eh?
If you are deleting (exagerated) a thousand directories, with a thousand subdirectories, all containing a thousand files, and you have to say "y" to each one, I think your eyes would pop out. However, if it's 5 directories/files total, then the verbose deleting wouldn't be so bad

Quote:
Originally posted by newbieME
Good Plan get a photo of his house burning down..and then we can send it to MasterC...maybe he can host it for us
I don't think I'd host that, sounds like it might get all legal and stuff However, if you get your friend to sign a consent form saying it's cool if you burn his house down, and that it's cool if I host the video/pic, then I'd be glad to

Cool
 
Old 03-05-2003, 06:20 PM   #15
cuckoopint
Member
 
Registered: Feb 2003
Distribution: Debian
Posts: 797

Rep: Reputation: 30
Quote:
If you are deleting (exagerated) a thousand directories, with a thousand subdirectories, all containing a thousand files, and you have to say "y" to each one, I think your eyes would pop out. However, if it's 5 directories/files total, then the verbose deleting wouldn't be so bad
This is what I meant: if you have the correct permissions, -r should unlink everything w/o a question (unless you have rm setup differently- maybe looking into bashrc, etc. help)
The -f would be used to answer yes each time for files you dont have 'explicit' write permissions, but that you 'can' still delete. ...oooh....going in circles. hopefully someone picked up the difference.
 
  


Reply



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
how to search for and delete empty directories? BrianK Programming 4 06-03-2005 07:24 AM
copy directories and subdirectories Red Squirrel Linux - Newbie 2 03-06-2004 09:18 PM
delete files / keep subdirectories? lhorstman Linux - Newbie 2 01-10-2003 03:01 PM
How does one delete directories with content as the SU? Ferrell Ramey Linux - General 2 08-22-2002 07:16 PM
Cant delete directories/files skopje909 Linux - General 2 11-07-2001 05:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:57 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration