On 27/11/2006 23:32, Chris Purves wrote:
I have a list of files that I have written to a file and I would like clamscan to read the list from that file and scan only the files in the list. Is there a good way to do this?

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.

What I am actually trying to do is have clamscan only scan files that are new or have not changed since the last scan. I have gotten as far as creating a filelist containing a list of files that are new or where the md5sum has changed. The problem I have now is how to get that information to clamscan efficiently.

It sounds like the ability to read the list of files to scan from a file (or from standard input) would be a useful feature to add to clamscan and clamdscan.

--
-=( 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