I need to check a directory and subfolders every hour, but only for new files.
So i wrote a script with these contents:
#!/bin/bash
find /var/www/html/files/ -ctime -1 |
clamscan -r --remove --log=/var/log/clam/clamscan.log
But for a reason, it doesn't check only the new files, it checks every file (about 6000).
The funny thing is, when I'm for example in the /tmp/ folder and I run find -ctime -1 | clamscan
it works.
So I guess I'm missing something but I can't think of what it is.
It appears that
/tmpsupports ctime but/var/www/html/filesis apparently on a different file system which doesn't.Lack of ctime support is relatively common for various reasons; probably try with
-mtimeinstead, or refactor to keep track of which files existed in the previous iteration (or perhaps switch toinotifyor similar) if you really absolutely have to watch for new files.