On 28/11/2006 19:06, Chris Purves wrote:
Ian Abbott wrote:
On 27/11/2006 23:32, Chris Purves wrote:
I have tried

cat filelist | xargs clamscan

This works, except that xarg can only pass about 200 filenames to clamscan at a time. So for a filelist containing 1000 filenames clamscan will be started 5 times, creating extra overhead.

You'll also find that it fails for file names containing whitespace, quote marks, or backslashes. To work around that, you could use

tr '\n' '\0' < filelist | xargs -0 clamscan

or generate the filelist with null-separated filenames in the first place (perhaps using find's -print0 command) to avoid the tr. This assumes you are using the GNU versions of find and xargs. The -0 option of GNU xargs causes it to use null-separated file names as-is and shell-quote them properly.

Yes, I was using find -print0 | xargs -0 combination when creating my filelist. I didn't know about the 'tr' command, though. You learn something new every day.

The 'tr' version still wouldn't work for filenames containing embedded newlines though, which is one reason why generating the filelist with null-separated filenames in the first place is better!

--
-=( Ian Abbott @ MEV Ltd.    E-mail: <[EMAIL PROTECTED]>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-
_______________________________________________
Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net
http://lurker.clamav.net/list/clamav-users.html

Reply via email to