On Nov 28, 2006, at 3:13 AM, Ian Abbott wrote:
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.
I certainly agree that using -print0/xargs -0 combination is a very
good idea when processing filenames which might contain arbitrary or
even maliciously chosen strings. Please note that the BSD version of
find and xargs acquired the -print0/-0 capabilities more than ten
years ago, shortly after they first appeared in the GNU version.
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.
Agreed. This is becoming a frequently requested capability. :-)
--
-Chuck
_______________________________________________
Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net
http://lurker.clamav.net/list/clamav-users.html