Click to See Complete Forum and Search --> : How do I Remove *.* from the CL?


woodyak
08-17-2001, 03:10 PM
I wish to delete a directory that has multiple files and directories in it. How do I delete the whole thing from the command line w/o it *****ing?

stiles
08-17-2001, 03:13 PM
rm -r <dir_name>

woodyak
08-17-2001, 03:17 PM
cool. Is there anyway to make it not ask me about deleting each file?

posterboy
08-17-2001, 03:20 PM
Try rm -rf (recursive + forced) but always think about what you are doing with this one. :)
Ray

asymblor
08-17-2001, 03:46 PM
Normally I would just flame & say RTFM but try experimenting:

1: always read the manual page for a particular command $man <command> or in your case $man rm

2: in your case for removing a directory or say a directory containing a directory you need not use the -f <force> switch.. try this:

$mkdir testdir
$cd testdir
testdir$mkdir testdir1
testdir$cd ..
$

now what you have is a directory called testdir in you home directroy containing a sub directory called testdir1 if you try to just do an: $rm testdir it will tell you bleh is a directory and you can 'think why- it makes good sense' now if you use rm -rf it just removes everything by force without prompting but if you want to do it a little more interactive you can try the -i switch which mean interactive.

well I'll let you do the rest just use use common sense & emperiment and remember to read the man!

asymblor

btw if you ever forget a command but you remember it started with a 'w' for ex do this:

$w <tab> <tab>

thats two hitting of the <tab> button in sucession and you will get a list of all commands that start with 'w' 8-)

posterboy
08-18-2001, 05:34 AM
Is there anyway to make it not ask me about deleting each file?

This tells me that his system has aliased rm to rm -i. Without a force (f), he is going to be asked about each deletion, and that was his question. Lots of distros do this by default, making rm an interactive command, example is RHat, which has done that since 5.2, at least. Ray

Derango
08-18-2001, 07:36 AM
Originally posted by posterboy:
<STRONG>Is there anyway to make it not ask me about deleting each file?

This tells me that his system has aliased rm to rm -i. Without a force (f), he is going to be asked about each deletion, and that was his question. Lots of distros do this by default, making rm an interactive command, example is RHat, which has done that since 5.2, at least. Ray</STRONG>

But having it ask about you deleting a file is also a good thing. If you just so happen to type "rm -r /" then you'll be thankful it asked :D

TacKat
08-18-2001, 08:19 AM
My rule: Never ever use rm -f (especially -fr) as root. I don't care if it takes extra typing, it's worth it. After that whole "I just did WHAT to my root directory?!?!?" incident, I've learned my lesson. :D