I have a surveillance camera that captures the database of images in my current state. Images are saved on my Linux. Image naming convention is below -
CAPTURE04.YYYYMMDDHHMMSS.jpg
The directory contains the following files -
CAPTURE04.20171020080501.jpg CAPTURE04.20171021101309.jpg CAPTURE04.20171021101913.jpg CAPTURE04.20171021102517.jpg CAPTURE04.20171021103422.jpg CAPTURE04.20171022103909.jpg CAPTURE04.20171022104512.jpg CAPTURE04.20171022105604.jpg CAPTURE04.20171022110101.jpg CAPTURE04.20171022112513.jpg ... and so on.
However, in fact, now I'm trying to find a way to get all the files between a specific date range (filename) using a terminal command. Note. It is necessary to monitor the file name (YYYYMMDDHHMMSS), and not the created / modified file time.
For example, I need to get all the files whose file name is between 2017-10-20 08:30:00 and 2017-10-22 09:30:00
I try to search google and get the following command -
find -type f -newermt "2017-10-20 08:30:00" \! -newermt "2017-10-22 09:30:00" -name '*.jpg'
It returns files created or modified in the specified date range. But I need to find the file base in this range of file names. Therefore, I think this does not work in my condition.
Also try the following command:
find . -maxdepth 1 -size +1c -type f \( -name 'CAPTURE04.20171020083000*.jpg' -o -name 'CAPTURE04.2017102209300*.jpg' \) | sort -n
This does not work..:(
Please help me write a real team. Thanks in advance.
source share