Need Help with -newer command

Ok, here's the situation:

There's a script that runs every day on a UNIX box that collects files. The script has now been changed so that at the start of a new day, the script would create a new folder and then copy files to it for that day.

This has put me in a dilema as I have a script that would check the folder for new files and copy them to another location. I accomplished this using the -newer command. But now that the files are copied to a new folder ech morning, I can't use the newer command any more, because at the beginning of the day there won't be a file to compare the newer file to.

How can I now, check the new folder for new files and to keep checking the new folder throughout the day for new files????

I hope that made sense. :frowning:

Make a reference file with the touch command with an access date and time of the last copy or whenever e.g.:

touch -d '2008-01-12 12:30:00' ref_file 

Now you can find the newer files every day with a script like:

#!/bin/sh

cd /yourdir
find * -newer ref_file -print >> list_of_new_files # write the output to file
echo "Last list made: `date`" >> ref_file # update the reference file

I hope this example gives you ideas that are helpful to you in your situation.

Regards