View previous topic :: View next topic |
Author |
Message |
bobpaul Tux's lil' helper
Joined: 09 Aug 2005 Posts: 148
|
Posted: Mon Jul 17, 2006 6:51 pm Post subject: Find -ctime shows too many results [Solved] |
|
|
I'm working on a backup script that copies server archives off our backup server and onto a removable hard drive. Since we do this weekly with rotation, I only want backups created within the last 7 days to show up. I'm using the command:
Code: | find /mnt/backups -ctime -7 | grep -- 'Full' | to find all full backups made within the last 7 days. This has worked fine until recently when it's given me 1 extra file:
Code: | # ls -l | grep UserData
-rwxrw---- 1 administrator users 79G Jul 15 05:50 UserData_Full- W3.bkf
-rwxrw---- 1 administrator users 72G Jun 20 04:13 UserData_Full-W4.bkf |
Here you can see that only 1 of these files is <= 7 days old. However, executing the find command like in the script shows.
Code: | # find . -ctime -7 | grep -- 'Full'
./UserData_Full-W3.bkf
./UserData_Full-W4.bkf |
If I lower the date down to 5 days, then it returns the expected results
Code: | # find . -ctime -5 | grep -- 'Full'
./UserData_Full-W3.bkf |
28 is clearly a bigger number than 7, yet the file still shows. Does anyone know why this might be returning this result? Is there somewhere else in the filesystem that a date would be stored that find is reading but ls -l isn't? We're using ReiserFs without XAttr support. Since this is a date related issue, today is Jul 17 local time.
Last edited by bobpaul on Tue Jul 25, 2006 1:20 pm; edited 1 time in total |
|
Back to top |
|
|
nixnut Bodhisattva
Joined: 09 Apr 2004 Posts: 10974 Location: the dutch mountains
|
Posted: Mon Jul 17, 2006 8:23 pm Post subject: |
|
|
Moved from Portage & Programming to Other Things Gentoo.
Doesn't look portage related, so moved here. _________________ Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered
talk is cheap. supply exceeds demand |
|
Back to top |
|
|
catam n00b
Joined: 22 Jul 2006 Posts: 10
|
Posted: Sat Jul 22, 2006 12:58 pm Post subject: |
|
|
ls by default shows mtime.
try
# ls -lc | grep UserData
to see ctime
catam |
|
Back to top |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9538 Location: beyond the rim
|
Posted: Sat Jul 22, 2006 4:15 pm Post subject: |
|
|
Any specific reason you use ctime instead of mtime? (note that ctime is not the creation time, see `info coreutils touch`). |
|
Back to top |
|
|
|