Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Find -ctime shows too many results [Solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
bobpaul
Tux's lil' helper
Tux's lil' helper


Joined: 09 Aug 2005
Posts: 148

PostPosted: Mon Jul 17, 2006 6:51 pm    Post subject: Find -ctime shows too many results [Solved] Reply with quote

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
View user's profile Send private message
nixnut
Bodhisattva
Bodhisattva


Joined: 09 Apr 2004
Posts: 10974
Location: the dutch mountains

PostPosted: Mon Jul 17, 2006 8:23 pm    Post subject: Reply with quote

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
View user's profile Send private message
catam
n00b
n00b


Joined: 22 Jul 2006
Posts: 10

PostPosted: Sat Jul 22, 2006 12:58 pm    Post subject: Reply with quote

ls by default shows mtime.
try
# ls -lc | grep UserData
to see ctime

catam
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9538
Location: beyond the rim

PostPosted: Sat Jul 22, 2006 4:15 pm    Post subject: Reply with quote

Any specific reason you use ctime instead of mtime? (note that ctime is not the creation time, see `info coreutils touch`).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum