I need to select all files that were added to a specific directory in the past 5 mins and copy them over to a different directory. I am using HP-UX OS which does not have support for amin, cmin, and mmin. B/c of this, I am creating a temp file and will use the find -newer command to compare files to a temporary file with an altered timestamp (5 mins ago). HP-UX does not support the -d option for the 'touch' command so I cannot do something like this:
touch -d "5 mins ago" temp
I have attempted to use the following solution, but receive an error (Illegal variable name) when I do:
TZ=ZZZ0 touch -t "$(TZ=ZZZ0:5 date +%Y%m%d%H%M.%S)" temp
Q: Does anyone know how I can select files added to the directory in the past 5 mins without needing to manipulate the time tag (minutes, days, months, ...)?
Note: My script will run every 5 mins, but I need the solution to be contained within the script (i.e., not depend on the fact that it will run every 5 mins). I cannot hardcode the timestamp.
Thanks,
Matt