cd /path/to/dir
touch now$$ # create a reference file
sleep 300 # wait for files to arrive
find . -newer now$$ -exec whatever_cmd {} \;
You can include other find search criteria e.g. a name pattern. Or in a loop, touch the ref file at every end of the iteration (before going to sleep).
cd /path/to/dir
process_all_files (find . -exec...)
touch now$$
sleep 300
while true
do
process files (find . -newer now$$ -exec...)
touch now$$
sleep 300
done
If you want this script to be restartable, perhaps you need a fixed ref-file name instead of "now$$", which would change on every invocation of the script (PID changes).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.