[Novalug] any clever options on 'rm'

Mike Shade mshade@mshade.org
Sun Oct 21 22:19:38 EDT 2007



On Sun, 21 Oct 2007 21:15:18 -0500 (CDT), Mike Shade <mshade@mshade.org>
wrote:
> Nina,
> 
> This is where piping commands together really helps.� RM is used for
> deleting files.� You use 'find' to find files with common criteria.
> 
> An example:
> 
> find . -type f -size -10k 
> 
> That finds all files less than 10 kilobytes, recursively, from the
> current directory.� The - before '10k' means less than; it's not
> another option.�You can use 10k by itself to find files exactly 10k
> in size, and  10k to find files greater than 10k in size.

The plus (+) seems to have dropped from that last sentence. Append a plus
sign to those last two mentions of '10k'.  

> After you've run that command and you're satisfied with its output,
> you can pipe it to xargs and the operation you want to perform on
> those files.� Like this, in your case:
> 
> find. -type f -size -10k | xargs rm -f
> 
> As always, be careful when using rm, verify the results of find
> first, and be happy.� I take no responsibility for blowing away
> wanted files with the above commands ;)
> 
> -- Mike
> On 21.10.2007 20:47 Nino Pereira 
> 
>  wrote
> List, 
> some .pdf files give, on extracting pictures with pdfimages, 
> a long list of very small pictures, under 10 kb or so. These 
> typically contain emblems, individual letters, or other useless 
> information. I want to remove them all, in one fell swoop, 
> and then be left with the others. 
> In the man pages for 'rm' I don't see an option that 
> restricts removal to files smaller than a given size. 
> Does such an option exist, and do I overlook it? Or is there 
> another way do remove lots of small files together? 
> Any suggestions? 
> Thank you, 
> Nino 
> _______________________________________________ 
> Novalug mailing list 
> Novalug@calypso.tux.org 
> http://calypso.tux.org/cgi-bin/mailman/listinfo/novalug 
> 




More information about the Novalug mailing list