I want to get the count of files coming into UNIX directory after certain date stamp.
eg I have a folder with the date 28062017
and files are copied to it in certain time.
I want to get the count of file coming from certain time. say
Jun 28 21:17 file 1
Jun 28 21:18 file 2
Jun 28 21:19 file 3
Jun 28 21:20 file 4
Jun 28 21:21 file 5
Jun 28 21:22 file 6
Jun 28 21:23 file 7
Jun 28 21:24 file 8
I want to have the count of files generated after Jun 28 21:21
.
Thanks
You can use find
using newermt
(for modification time): find . -newermt "2017-01-03" -type f -ls | wc -l
find . -newermt "2017-01-03" -type f -ls | wc -l
find . -newermt "2017-01-03" -type f -ls | wc -l
and than count the number of lines.
For example:
herbert@projects:~/tmp/datetest$ touch -t 201701020100 a.txt
herbert@projects:~/tmp/datetest$ touch -t 201701030100 b.txt
herbert@projects:~/tmp/datetest$ touch -t 201701040100 c.txt
herbert@projects:~/tmp/datetest$ find . -newermt "2017-01-03" -type f -ls
82353 0 -rw-r--r-- 1 herbert herbert 0 Jan 4 01:00 ./c.txt
82352 0 -rw-r--r-- 1 herbert herbert 0 Jan 3 01:00 ./b.txt
herbert@projects:~/tmp/datetest$ find . -newermt "2017-01-03" -type f -ls | wc -l
2
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.