Re: [Clamav-users] Suggestion: Read list of files to scan from file/stdin {Scanned}

2004-01-28 Thread Jo Mills
On Wed, Jan 28, 2004 at 08:20:41AM +0100, Tomasz Kojm wrote:
 On Tue, 27 Jan 2004 15:23:56 -0800 (PST)
 Ryan Finnie [EMAIL PROTECTED] wrote:
 
  find /path -ctime -1 -exec clamscan \{\} \;
  
  but that invokes clamscan for EVERY matching file found.  Instead, I
  would like to request that a new flag, say -f, be added to
  clamscan/clamdscan that takes a list of files, one file per line, from
  a file (-f file) or stdin (-f -).  That way you could do:
  
  find /path -ctime -1 | clamscan -i -f -
  
  or:
  
  find /path -ctime -1  /tmp/toscan
  clamscan -i -f /tmp/toscan
  
  and put it in a nightly cron job.  What do you think?
 
 You can use the CVS version - clamscan supports multiple file arguments
 from command line, and build a script that executes clamscan on a bunch
 of files. You can fall into a problem with special characters and
 spaces, though.

Just a thought - perhaps you could modify the tob (Tape Orientated
Backup) scripts to do this.  Tob supports full, incremental and
differential file listings.

Jo.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.



---
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
___
Clamav-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/clamav-users


Re: [Clamav-users] Suggestion: Read list of files to scan from file/stdin

2004-01-28 Thread Tomasz Papszun
On Tue, 27 Jan 2004 at 15:23:56 -0800, Ryan Finnie wrote:
 
 I was looking for a way to set up a cron job to, once per day, scan only
 files that have changed in the last day.  find works pretty well for that,
 but the question is how to get the data to clamscan.  My first thought was
 xargs, but xargs isn't the most consistent when dealing with spaces/quotes
 in filenames, 

For a tip, read on...

 and plus you have a limit on the total size of args passed
 to a program.  The current best working solution would be to do this:
 
 find /path -ctime -1 -exec clamscan \{\} \;
 
 but that invokes clamscan for EVERY matching file found.  Instead, I would

To minimize wasting time and resources on invoking clamscan for multiple
files, use clamdscan.

 like to request that a new flag, say -f, be added to clamscan/clamdscan
 that takes a list of files, one file per line, from a file (-f file) or
 stdin (-f -).  That way you could do:
 
 find /path -ctime -1 | clamscan -i -f -
 
 or:
 
 find /path -ctime -1  /tmp/toscan
 clamscan -i -f /tmp/toscan
 
 and put it in a nightly cron job.  What do you think?
 
 RF

Tips related to filenames with spaces, quotes etc.:

find /path -ctime -1 -print0 | xargs -0r command


man find:
   -print0
  True; print the full file name on the standard out­
  put, followed by a  null  character.   This  allows
  file  names  that  contain newlines to be correctly
  interpreted by programs that process the find  out­
  put.


man xargs:
   --null, -0
  Input filenames are terminated by a null  character
  instead  of by whitespace, and the quotes and back­
  slash are not special  (every  character  is  taken
  literally).  Disables the end of file string, which
  is treated like any other  argument.   Useful  when
  arguments  might  contain white space, quote marks,
  or backslashes.  The GNU find -print0  option  pro­
  duces input suitable for this mode.

   --no-run-if-empty, -r
  If  the  standard  input  does not contain any non­
  blanks, do not run the command.  Normally, the com­
  mand is run once even if there is no input.


-- 
 Tomasz Papszun   SysAdm @ TP S.A. Lodz, Poland  | And it's only
 [EMAIL PROTECTED]   http://www.lodz.tpsa.pl/   | ones and zeros.
 [EMAIL PROTECTED]   http://www.ClamAV.net/   A GPL virus scanner


---
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
___
Clamav-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/clamav-users


Re: [Clamav-users] Suggestion: Read list of files to scan from file/stdin

2004-01-28 Thread Tomasz Kojm
On Tue, 27 Jan 2004 15:23:56 -0800 (PST)
Ryan Finnie [EMAIL PROTECTED] wrote:

 find /path -ctime -1 -exec clamscan \{\} \;
 
 but that invokes clamscan for EVERY matching file found.  Instead, I
 would like to request that a new flag, say -f, be added to
 clamscan/clamdscan that takes a list of files, one file per line, from
 a file (-f file) or stdin (-f -).  That way you could do:
 
 find /path -ctime -1 | clamscan -i -f -
 
 or:
 
 find /path -ctime -1  /tmp/toscan
 clamscan -i -f /tmp/toscan
 
 and put it in a nightly cron job.  What do you think?

You can use the CVS version - clamscan supports multiple file arguments
from command line, and build a script that executes clamscan on a bunch
of files. You can fall into a problem with special characters and
spaces, though.

Best regards,
Tomasz Kojm
-- 
  oo.   [EMAIL PROTECTED] www.ClamAV.net
 (\/)\. http://www.clamav.net/gpg/tkojm.gpg
\..._   0DCA5A08407D5288279DB43454822DC8985A444B
  //\   /\  Wed Jan 28 08:17:06 CET 2004


pgp0.pgp
Description: PGP signature


[Clamav-users] Suggestion: Read list of files to scan from file/stdin

2004-01-27 Thread Ryan Finnie
Hello,

I was looking for a way to set up a cron job to, once per day, scan only
files that have changed in the last day.  find works pretty well for that,
but the question is how to get the data to clamscan.  My first thought was
xargs, but xargs isn't the most consistent when dealing with spaces/quotes
in filenames, and plus you have a limit on the total size of args passed
to a program.  The current best working solution would be to do this:

find /path -ctime -1 -exec clamscan \{\} \;

but that invokes clamscan for EVERY matching file found.  Instead, I would
like to request that a new flag, say -f, be added to clamscan/clamdscan
that takes a list of files, one file per line, from a file (-f file) or
stdin (-f -).  That way you could do:

find /path -ctime -1 | clamscan -i -f -

or:

find /path -ctime -1  /tmp/toscan
clamscan -i -f /tmp/toscan

and put it in a nightly cron job.  What do you think?

RF


---
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
___
Clamav-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/clamav-users