Page 1 of 1

Removing multiple files? What a pain!

Posted: Tue Jul 18, 2006 11:40 am
by Ree
I, the windows guy, stepped into the Linux world. :lol: My hands are tired from typing all those tiny commands in my SSH client. I wonder how come I cannot tell the damn machine 'delete the whole stuff inside [dir] and don't ask me anything'. rm description says:

-r — recursive. Will delete a directory and all files and subdirectories it contains.

I run 'rm -r mydir' and it should just delete the whole dir. But it doesn't, it keeps asking me for confirmation of deleting subdirectories and files.

rm: descend into directory `php-5.1.4'? y
rm: descend into directory `php-5.1.4/ext'? y
rm: descend into directory `php-5.1.4/ext/standard'? y
rm: descend into directory `php-5.1.4/ext/standard/tests'? y
rm: descend into directory `php-5.1.4/ext/standard/tests/file'? y
rm: remove regular file `php-5.1.4/ext/standard/tests/file/bug32160.phpt'? y
rm: remove regular file `php-5.1.4/ext/standard/tests/file/bug32160.txt'? y
rm: remove regular file `php-5.1.4/ext/standard/tests/file/bug35740.phpt'? y
rm: remove regular file `php-5.1.4/ext/standard/tests/file/bug35781.phpt'? y
rm: remove regular file `php-5.1.4/ext/standard/tests/file/bug37158.phpt'? y

I don't want to believe you can't delete multiple files/dirs quickly. Please tell me I am wrong and let me know the correct way to do that.

Posted: Tue Jul 18, 2006 11:52 am
by Ree
OK, -rf. But why nobody bothers to mention this in the manuals?

Posted: Tue Jul 18, 2006 12:08 pm
by Roja
Ree wrote:OK, -rf. But why nobody bothers to mention this in the manuals?
It does: http://unixhelp.ed.ac.uk/CGI/man-cgi?rm (See -r , -f, and so forth).

The less humorous reply is that those are mentioned later to avoid a new user performing rm -rf from / , as root, destroying the OS.

Posted: Tue Jul 18, 2006 12:28 pm
by Ree
Oh yeah, they do mention all those letters:

rm -r
rm -f
...

But they didn't mention they can be used together.

Posted: Tue Jul 18, 2006 12:36 pm
by sweatje
Was right at the top of the man file for me...
man rm wrote:
NAME
rm - remove files or directories

SYNOPSIS
rm [options] file...

POSIX options: [-fiRr] [--]

GNU options (shortest form): [-dfirvR] [--help] [--version] [--]

Posted: Tue Jul 18, 2006 3:21 pm
by Christopher
Are people suggesting:

man -RTF ;)

Posted: Tue Jul 18, 2006 5:40 pm
by Chris Corbyn
It actually sounds like you may have rm set to alias as `rm -i'. SuSE linux used to do this by default.

Check your .profile and .bashrc scripts for:

"Alias rm=rm -i"