Operating System - HP-UX
1833042 Members
2407 Online
110049 Solutions
New Discussion

Re: Find -atime changing access times

 
SOLVED
Go to solution
Kevin Lamb
Frequent Advisor

Find -atime changing access times

Hi,

Does anyone know a way of using the -atime switch with find, without the command itself changing the access times of the directories within the search path to the date that you ran the command.

Any help with this would be appreciated as we use the atime on directories as part of our archiving policy, and every time we run the command the access time on the directories is changed by the command.

Kindest regards,

Kev

6 REPLIES 6
harry d brown jr
Honored Contributor

Re: Find -atime changing access times

Kevin,

I'm running 10.20, 11.0, and 11i and I don't see that behavior. Could you supply the find command that you are executing? Also, are you servers up to date with the latest major patch bundle?


live free or die
harry
Live Free or Die
John Palmer
Honored Contributor
Solution

Re: Find -atime changing access times

Hi Kevin,

I don't think its possible. The man page for find specifically states that 'the access time of directories in pathname-list is changed by find' which is what you would expect as it has to read the directories.

Can you change your archiving policy? I'd have thought that mtime is the relevant value for selecting files to be archived rather than atime.

Regards,
John

Robin Wakefield
Honored Contributor

Re: Find -atime changing access times

Hi Kev,

This is as documented, and even an "ls" changes the atime. If you knew what you wanted it to be, you could use "touch -a -t .... dirname" to change it back, but I'm not sure this is feasible in your situation.

Rgds, Robin.



Pal Szabo_1
Valued Contributor

Re: Find -atime changing access times

Hi!

I think you cannot done
it.Because not only the find command, but every command
which enter into a directory,
change the access time of it.
It is coded in the filesystem.
(Check it with ls -u option)

# ls -alu .
Wait for 2 minutes
# ls -alu
(The time of . show the current time)

I think the solution could be
that you modify the backup policy, based on the modification date of the files.


Regards:
Paul
harry d brown jr
Honored Contributor

Re: Find -atime changing access times

Kevin,

Sorry, my stupidity, I was thinking of the files and not the directories.

live free or die
harry
Live Free or Die
harry d brown jr
Honored Contributor

Re: Find -atime changing access times

Kevin,

This can be done, by writing a perl program to search for access time:

http://library.cs.tuiasi.ro/programming/perl/cookbook-UNPARSED/ch09_02.htm

Here's another sample of perl programs doing file stuff:

http://pleac.sourceforge.net/pleac_python/directories.html

live free or die
harry
Live Free or Die