Skip to contentSkip to conversation

recursively removing directories

DISCUSSION Matthew Stapleton 4 participants 4 messages Jun 30, 2002

lore
Share & tools
lore
#0 lore raw

How do I recursively remove all the subdirectories and contents of a particular directory in Linux? I know of 'rmdir', but this only works for empty directories. I need something like DOS's 'deltree'.

Thanks,
Matthew Stapleton

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#1 lore raw
Quoted 4 lines · Matthew Stapleton

How do I recursively remove all the subdirectories and contents of a particular directory in Linux? I know of 'rmdir', but this only works for empty directories. I need something like DOS's 'deltree'.

Quoted 10 lines

Thanks,
Matthew Stapleton

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

Like this rm -rf /whatever the -r is ofcourse recursive and the -f is force is it won't ask you.

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#2 lore raw
Quoted 5 lines · Joseph Jackson
Quoted 4 lines · Matthew Stapleton

How do I recursively remove all the subdirectories and contents of a particular directory in Linux? I know of 'rmdir', but this only works for empty directories. I need something like DOS's 'deltree'.

Quoted 7 lines
Quoted 3 lines

Thanks,
Matthew Stapleton

Like this rm -rf /whatever the -r is ofcourse recursive and the -f is force is it won't ask you.

... and be VERY CAREFUL using it!!!!

(man rm will give you the syntax).

cr
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#3 lore raw
In reply to Matthew Stapleton
Quoted 3 lines · Matthew Stapleton

How do I recursively remove all the subdirectories and contents of a particular directory in Linux? I know of 'rmdir', but this only works for empty directories. I need something like DOS's 'deltree'.

You got 2 other answers to your question, one mentioned the need to be "very carefull" with rm, what they did not say is you can wipe out your complete system with rm and its options.
I would strongly advise you to use 'mc' the linux answer to midnight-commander.
You will have more oversight as to what you are deleting and will not be faced with the same problem we saw here a few days ago when someone asked how he could recover his system after he made a mistake with rm -rf.

Quoted 3 lines

Thanks,
Matthew Stapleton

Signature · 11 lines
Regards Richard
[email protected]
http://people.zeelandnet.nl/pa3gcu/



-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs