Reputation:
How can I list files within specific time range:
Upvotes: 2
Views: 1826
Reputation: 724
The find command an option, -newerXY, which simplifies the problem:
$ find . -name "*.html" -newermt "13-Sep-2023 1:49" ! -newermt "13-sep-2023 1:49:21.75" | wc -l
52
$ find . -name "*.html" -newermt "13-Sep-2023 1:49" ! -newermt "2023-09-13T01:49:23" | wc -l
64
There may be other acceptable time formats. The man page is not clear about that.
Upvotes: 0
Reputation: 51663
find /YOUR/SEARCH/DIR -type f -mmin -300 2> /dev/null
Finds every file for your first criteria.
For the second:
touch -d "2011-12-10" 2012-12-10
touch -d "2011-12-21" 2012-12-21
find /YOUR/SEARCH/DIR -type f -anewer 2012-12-10 ! -anewer 2012-12-21 2> /dev/null
It first creates two reference files based on your date criterias, then search by using them.
Upvotes: 4