Linux: RM Files Using xargs. Another: Argument list too long
Here is another example of removing files from a Linux system when faced with error Argument list too long. This time, I was trying to remove log files from an ESX cluster after a few core dumps and ISCSI problems.
To start, here is the failed command
# rm -f `find /vmfs/volumes/ -ctime 3 | grep “.log” | grep “vmware-”`
-bash: /bin/rm: Argument list too long
Here is the total file count that I needed to be removed
# find /vmfs/volumes/ -ctime 3 | grep “.log” | grep “vmware-” | wc -l
4982
The successful command string using xargs
# find /vmfs/volumes/ -ctime 3 | grep “.log” | grep “vmware-” | xargs rm

[...] http://blog.colovirt.com/2008/11/15/rm-files-using-xargs-another-argument-list-too-long/ Possibly related posts: (automatically generated)Working with Files and Directory [...]
Quick Linux rm find. Recursively delete files containing wildcards « Colocation to Virtualization said this on November 17, 2008 at 11:36 am