posix
June 3, 2010, 1:49am
1
Hi,
Is it possible to get all the files modified in the last week (Not before or after that week) . I have tried with date range it works for me for the period of seven days , not exactly for weekly basis .
Fetching records for seven day by
find -mtime +6 -a -mtime -13
As today date is 3rd June , it should fetch files modified of date range 23rd to 29th of May.
thanks
posix..
I think that will give you proper results:
find . -daystart -mtime +6 -a -mtime -13
posix
June 3, 2010, 6:36am
3
sorry , it's not help full for me
$ls -ltr
total 20
-rw-r--r-- 1 root root 0 May 18 23:15 jd15234
-rw-r--r-- 1 root root 0 May 19 23:15 je13795
-rw-r--r-- 1 root root 0 May 20 23:15 jkl
-rw-r--r-- 1 root root 29 May 21 00:20 rd11673
-rw-r--r-- 1 root root 0 May 21 23:15 ka12684
-rw-r--r-- 1 root root 0 May 22 23:15 kb27948
-rw-r--r-- 1 root root 0 May 23 23:15 kc27447
-rw-r--r-- 1 root root 0 May 24 23:15 kd31910
-rw-r--r-- 1 root root 0 May 25 23:15 ma6198
-rw-r--r-- 1 root root 0 May 26 23:15 mb21233
-rw-r--r-- 1 root root 0 May 27 23:15 mc2490
-rw-r--r-- 1 root root 0 May 28 23:15 md8924
-rw-r--r-- 1 root root 0 May 29 23:15 me9158
Date range is not the last week range..
$find . -daystart -mtime +6 -a -mtime -13 -exec ls -l {} \;
-rw-r--r-- 1 root root 0 May 24 23:15 ./kd31910
-rw-r--r-- 1 root root 0 May 26 23:15 ./mb21233
-rw-r--r-- 1 root root 0 May 23 23:15 ./kc27447
-rw-r--r-- 1 root root 0 May 22 23:15 ./xyz/af
-rw-r--r-- 1 root root 0 May 22 23:15 ./kb27948
-rw-r--r-- 1 root root 0 May 27 23:15 ./mc2490
-rw-r--r-- 1 root root 0 May 25 23:15 ./ma6198
Is there any method to track the weekly records?
try adjusting those day parameters. Also check if date on your system is correct with:
date
kshji
June 3, 2010, 10:47am
5
This works fine in my environment: 1st day is monday and it's 1, sunday is 7.
day=$(date +%u) # return 4 in my env (2010-06-03 Thu)
((day1=day-1))
((day2=day+7))
find . -mtime +$day1 -a -mtime -$day2
curleb
June 3, 2010, 12:57pm
6