-   Linux - Newbie (
-   -   Unix rm files of same size (

Gurr 12-08-2006 02:55 AM

Unix rm files of same size
Hi all,

I'm looking for a way to remove all files of the same
size in one directory, in this case 0bytes.


Thanks in advance!

acid_kewpie 12-08-2006 03:03 AM

find -size 0 -exec rm {} \;

Gurr 12-08-2006 04:15 AM

Thanks for response.


find -size 0 -exec rm {} \;
- searches subdirectories as well and removes the matches.


for i in `ls`; do if [ -s $i ]; then echo $i data; else rm $i; fi; done
- found this that only removes in current directory and not subdirectories.


bigrigdriver 12-08-2006 04:22 AM

find /<path>/<to>/<directory> -size 0 -exec rm {} \;

should also restrict the search to the named directory.

All times are GMT -5. The time now is 08:53 PM.