For instance, find all files created between 20:00 and 23:30 for any day (not a specific day)?
been going through man find
and didn't see anything that would do this.
Would I have to write my own script to parse create times?
You can use -newerXY
to find files between those times on a specific day, as in:
find -newermt "20150203 2000" -a \! \( -newermt "20150203 2330" \)
I've use the modification time because my ext4 file system does not hold creation times. If you have a file system which supports it, you can use -newerBt
.
If you need to find files between those times on any day, then you need to run a script for each file in your find
list. The easiest command for this would be stat -c %y "$1"
and then extract and analyse the time field.
You could do arithmetic on the seconds of day (($(stat -c %Y "$1") % 86400))
, checking it's between 72000 and 84600, but this would ignore summer time, identifying files modified between 21:00 and 00:30 during the summer.
Use this command below:
find . -mtime $(date +%s -d"Aug 10, 2013 23:30:00") -mtime $(date +%s -d"Aug 1, 2013 20:00:00")
or try this:
find /var/tmp -mtime +2 -a -mtime -8 -ls
to find files older than 2 days but not older than 8 days.