On Tue, Nov 26, 2002 at 09:33:45AM +0530, mukund wrote:
> I need to delete files based on size and extension and that to recursively
> (in sub directories also)
> How to do it using shell commands only.

find /path/to/dir <various predicates here to choose your file> -print0 | xargs -0 rm 
-f

Eg: To delete files with extension .exe and size greater than 100kb:

find /path -iname "*.exe" -a -size +100k -print0 | xargs -0 rm -f

-print0 to use \0 rather than \n as separators between consecutive matches,
-0 to tell xargs of this (helps in managing filenames with spaces in
them). -a is redundant since the default logical operator is AND.

Test your find command line before feeding it to rm -f. You will be
sadder but wiser otherwise. :)

Binand

-- 
If you found this helpful, please take some time off to rate it:
http://svcs.affero.net/rm.php?r=binand


-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T 
handheld. Power & Color in a compact size! 
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to