Chuck Swiger a écrit :
Roman ZARAGOCI wrote:
[ ... ]
For example, I would want to scan only new files added to homes
directories or by checking the modification date of files.
Maybe someone has already made this sort of script ?
If you run something like:
find /home -mtime -2 -type f -print0 | xargs -0 clamdscan
I've got a specific problem with my script, let me explain what it does :
1) # First, the script build a text file named "file1" containing all
modified files last day
find /home -mtime -1 -type f > /tmp/file1
2) # Then, the command grep excludes all lines containing "mail" (to not
scan mail files - too long and already scan by another soft)
grep -v mail /tmp/file1 > /tmp/file2
3) # Because clamdscan needs a single line as parameter to specify
files/repertories to scan, I apply this :
while read line; do echo -e "\"$line\" \c"; done < file2
So, the file named "file2" contains a single line with this format :
"/home/first file" "/home/second file" ...
I add a double-quote to scan files with spaces.
But when I do :
while read line; do echo -e "\"$line\" \c"; done < file2 | xargs -0
clamdscan
clamdscan replies :
[...] "/home/tbigo/some file.exe" "/home/updvir/update.ini"
"/home/updvir/dat-4746.zip" : File name too long
----------- SCAN SUMMARY -----------
Infected files: 0
Time: 0.007 sec (0 m 0 s)
Clamdscan doesn't understand that it is a list of files. When I do it
manually, that's work fine.
I wish I was understandable and excuse-me for my scholarly English level :)
Thanks again for your help ;) This list has very efficient users !
_______________________________________________
http://lurker.clamav.net/list/clamav-users.html