useful unix command: xargs
In our mailserver, we backup every incoming email and keep it for a week. Sometime, it’s PITA when you want to purge the old email. For example;
[takizo@rooney backup]# rm -rf S0118*
-bash: /bin/rm: Argument list too long
when come to rm large amount of files, or editing, or rename, xargs is … very useful, no more PITA.
[takizo@rooney backup]# find . -name ‘S0118*’ | xargs rm
that’s it, so my friend, don’t do rm S011800*, S011802*, S011803*, S011804*, S011823 …. It’s wasting your time 😀
update 20080721 : for file name with spaces with it use “find . -iname ‘S0118*’ -print0 | xargs -0 rm”.
thankz!!
If you get “argument list too long” error again with xargs, its time to use
$ find . -name ‘S0118*’ -exec rm {} \;
😉
help
whare is ablevel openwebmail users address book in linux 9
my id is pspal83@gmail.com
if the file/directory name has spaces in it, use “find ./ -iname ‘S0118*’ -print0 | xargs -0 rm -rf” instead …