LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How can i delete Directories and Subdirectories? (https://www.linuxquestions.org/questions/linux-newbie-8/how-can-i-delete-directories-and-subdirectories-48050/)

OrganicX 03-03-2003 12:12 PM

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?

acid_kewpie 03-03-2003 12:34 PM

rm -rf

skidhmor 03-03-2003 12:36 PM

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.

OrganicX 03-03-2003 01:53 PM

thanks, that works great

iceman47 03-03-2003 07:15 PM

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

skidhmor 03-03-2003 09:36 PM

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.

newbieME 03-03-2003 09:53 PM

i dare you..try -rf in root..come on!! :P

cuckoopint 03-03-2003 10:09 PM

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?

iceman47 03-03-2003 10:29 PM

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 :(

watashiwaotaku7 03-04-2003 12:10 AM

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

newbieME 03-04-2003 08:08 AM

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 :D

watashiwaotaku7 03-04-2003 04:25 PM

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

newbieME 03-04-2003 06:04 PM

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 ;)

MasterC 03-05-2003 02:07 AM

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
:D 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 :D

Cool

cuckoopint 03-05-2003 06:20 PM

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.


All times are GMT -5. The time now is 12:47 PM.