I'm writing a shell script that retrieves all files in a directory that were last modified x days ago, starting from 00:00 on the current day.
The current find command I use for this is shown below, but this will start its check from the time the script is run. E.g. if the script was run at 12:00 and retrieved all files modified 7 days ago or more, all files that were modified after 12:00 7 days ago will not be included in the find results.
find $SEARCH_DIR -mtime +$DAYS_AGO
I know that in Bash you can use -daystart with find to overcome this, but the script needs to run on an IBM z/OS machine that uses the /bin/sh shell, which doesn't support this option.
I've seen other cases where people have created a file using touch and changed the timestamp to the desired date using date -d or date --date as shown below, but again these options aren't open to me with this shell.
date -d '7 days ago'
date --date '3 months 1 day ago'
This PDF shows a complete list of the UNIX commands supported on our IBM z/OS version: http://publibfp.dhe.ibm.com/epubs/pdf/bpxza5c0.pdf
Does anyone have any ideas about how to overcome this problem? Any advice would be greatly appreciated.
Thanks in advance!