29
votes
5answers
1k views

Deleting millions of files

I had a dir fill up with millions of gif images. Too many for rm command. I have been trying the find command like this: find . -name "*.gif" -print0 | xargs -0 rm Problem is, it bogs down my ...
3
votes
1answer
442 views

Fastest way to delete a non empty directory in Linux

I use the command rm -rf directory but i came across the following article : Article That suggests that rsynch to an empty folder is the fastest way? rsync -a –delete empty/ a Why is this the case ? ...
-3
votes
2answers
1k views

“rm -rf /” VS. “mv -r / /dev/null”

Might be a stupid question, but what would be the worst for your system ? (I think both) But to my opinion mv would be the fastest to "delete" it all. Am I wrong ? (don't wana test aniway ^^ )
-2
votes
3answers
450 views

A file which is not a dir nor a file

This may look like a weird question, but I just got this output for a file (directory?) in my system. This may be a trivial or well-known error, but for me, this file (directory?) called ...
5
votes
1answer
148 views

Explaining the -W flag for rm

What does the -W flag for rm do? According to its man page, the flag attempts to "undelete the named files." And currently, "this option can only be used to recover files covered by whiteouts." What ...
0
votes
4answers
2k views

How to recursively remove all .exe files from all the subdirectories of the current directory?

I have a USB containing important files. However it is infiltrated with some unwanted .exe files (probably virsuses) in each subfolder. Since I am on a Linux machine, the exe files won't affect me. ...
4
votes
2answers
462 views

Does rm work alphabetically?

I had many files in a folder in which I accidentally ran rm * before interrupting. It looks like files starting with a, b, and c are gone, but I am not sure, as I didn't know the name of all the ...
1
vote
2answers
1k views

Remove directories from a file with list of directories

I have a list of directories in a text file and each of them need to be deleted. How can I read in that list into the command (rm -r or rmdir)?
7
votes
6answers
3k views

Best practices to alias the rm command and make it safer

Some time ago I erroneously deleted my home folder because I ran a rm -rf * on the wrong terminal, whose working directory was the home folder! I wish I had an alias for the rm command, but it was ...
2
votes
11answers
2k views

How can I block execution of rm -rf * in a Linux shell?

I have a habit of typing rm -rf * every time I'm in some kind of sleep mode. It seems that my subconscious wants me to delete everything I code at the end of the day. Is there a way to block this ...
0
votes
4answers
857 views

Remove files that don't end on “.py” using rm [duplicate]

Possible Duplicate: Remove all files but one with rm This is a very simple question and i dont know whether a solution exists or not. I have some files in a directory, assume i have .py ...
4
votes
2answers
2k views

Bash to delete a files older than X days

So I have a cron setup to make backups of a folder into a tarball every hour. I would like to add into the shell script that I'm using the ability to have files deleted automagically after about three ...
1
vote
1answer
202 views

Can I list file names (or their parent directories) that were recently deleted using rm in OS X?

Is it possible to find out which files and directories have recently been deleted by rm in OS X? Or failing that, is it possible to find which parent directories have had files or directories within ...
54
votes
7answers
36k views

How do I make rm not give an error if a file doesn't exist?

I'm writing a makefile that will clean up some useless files at the end of the compilation. If a target has already been made, it will of course skip that target and the useless file may not be ...