Results 1 to 3 of 3
hi
i am a newbie in linux ,i am writing a bash script to identify the files which are exactly 7 days ( a week old)
i tried this command
...
- 04-19-2010 #1Just Joined!
- Join Date
- Mar 2010
- Posts
- 6
finding files exactly 7 days old
hi
i am a newbie in linux ,i am writing a bash script to identify the files which are exactly 7 days ( a week old)
i tried this command
find /var/backup -mtime +7 -exec ls -d {} \;
but this gives me even the files which are older than 7 days
find . -mtime +7 -exec ls -d {} \;
./access.log.1.gz
./access.log.2.gz
./access.log.2.gz19Apr10
./access.log.3.gz
./access.log.3.gz19Apr10
./access.log.4.gz
i want only the file which is 7 days old
- 04-19-2010 #2Linux Newbie
- Join Date
- Mar 2009
- Posts
- 228
Try this:
Code:find . -mtime +6 -mtime -8 -exec ls -d {} \;
- 04-21-2010 #3Just Joined!
- Join Date
- Apr 2010
- Posts
- 5
hey
dont put a + before 7,
that means you're finding files MORE than seven days.
check the find command man page


Reply With Quote