LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Unix rm files of same size (https://www.linuxquestions.org/questions/linux-newbie-8/unix-rm-files-of-same-size-508466/)

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.

$>rm...

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.

Quote:

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

Quote:

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 12:32 PM.