Page 1 of 1

removing content of directory

Posted: Tue Jul 20, 2004 8:04 pm
by Red Squirrel
How can I delete the entire content of a directory with a single command? I want the equivalent of del foldername*.* I started rm'ing the files individualy but it's just too long. For some reason a bunch of mail got stuck in the mail queue and it keeps bouncing all over the server and not going anywhere and it's muliplying each time. It's at like 300+ now so I just want to delete them. webmin only allows me to delete 20 at once which is stupid, so that takes long too.

Archived topic from Anythingforums, old topic ID:614, old post ID:5382

removing content of directory

Posted: Wed Jul 21, 2004 2:31 am
by wldkos
rm -rf *

make sure your in the directory that you want this to happen. You can use rm -rf /home/red/ohnooos!

but i've have bad mistakes with that deleting things that can't come back. The "rm" tool doesn't have a recycle bin ;)

Archived topic from Anythingforums, old topic ID:614, old post ID:5405

removing content of directory

Posted: Wed Jul 21, 2004 3:46 am
by megaspaz
The "rm" tool doesn't have a recycle bin
neither does using del or deltree in windows.

Archived topic from Anythingforums, old topic ID:614, old post ID:5408

removing content of directory

Posted: Wed Jul 21, 2004 7:47 am
by Cisco_Kid
megaspaz wrote:
The "rm" tool doesn't have a recycle bin
neither does using del or deltree in windows.
I would think not as the recycle bin was not stolen from the Mac system GUI until win95 when windows finally just started to catch up on the visual side.


Archived topic from Anythingforums, old topic ID:614, old post ID:5409

removing content of directory

Posted: Wed Jul 21, 2004 5:53 pm
by Red Squirrel
Thanks rm -f * worked

Well deleted stuff is recoverable, just not an easy task to do and you need a special program, which starts at a few grand and is hard to get at discount stores such as K-mart (Kazaa mart)



Archived topic from Anythingforums, old topic ID:614, old post ID:5420

removing content of directory

Posted: Thu Jul 22, 2004 10:52 am
by wldkos
rm -rf -- using the 'r' means recursive, and the 'f' means force, so it won't ask you if you want to delete the files.

Archived topic from Anythingforums, old topic ID:614, old post ID:5477

removing content of directory

Posted: Thu Jul 22, 2004 5:53 pm
by Red Squirrel
Yeah I knew that. That's why I never type rm -rf / :D

Archived topic from Anythingforums, old topic ID:614, old post ID:5487

removing content of directory

Posted: Sat Jul 24, 2004 5:12 am
by megaspaz
rm -rf / can be pretty totally safe... if invoked as a regular user. the only things that i know of off a default install that would get deleted would be files and directories owned by the user in /tmp.

*disclaimer, try it at your own risk. :P

Archived topic from Anythingforums, old topic ID:614, old post ID:5662

removing content of directory

Posted: Sun Jul 25, 2004 5:06 pm
by Red Squirrel
unless you do a recursive chmod 777 on the / before. :o

Archived topic from Anythingforums, old topic ID:614, old post ID:5813

removing content of directory

Posted: Sun Jul 25, 2004 11:21 pm
by megaspaz
Red Squirrel wrote: unless you do a recursive chmod 777 on the / before. :o
well then i guess you'd better stay away from chmod and rm. :P

Archived topic from Anythingforums, old topic ID:614, old post ID:5845

removing content of directory

Posted: Mon Jul 26, 2004 6:22 pm
by Red Squirrel
Yep. But it would be near impossible to do both by accident though so that's reassuring. :D

So.... is the fact that I do everything under root bad? Since most things have it documented that it only works under root, so I never bothered making another account. So if I do rm -rf / will it delete everything? :o (including any mapped drives etc...)


Archived topic from Anythingforums, old topic ID:614, old post ID:5865

removing content of directory

Posted: Thu Aug 26, 2004 10:17 pm
by closet geek
Red Squirrel wrote: So.... is the fact that I do everything under root bad?  Since most things have it documented that it only works under root, so I never bothered making another account.  So if I do rm -rf / will it delete everything?  :o  (including any mapped drives etc...)
:huh:

By doing so you are bypassing one of the nicest security features of the linux kernel. It's your choice, but get into the bad habit now and you'll end up regretting it.

Andrew

Archived topic from Anythingforums, old topic ID:614, old post ID:9318

removing content of directory

Posted: Fri Aug 27, 2004 6:09 pm
by Red Squirrel
But what's the other alternative?

Whenever I read something it says that it only works under root. Obviously I have my server programs running as their own user (ex: apache runs under "apache") but for installing stuff and all that, I go under root.

Archived topic from Anythingforums, old topic ID:614, old post ID:9534