1834483 Members
3359 Online
110067 Solutions
New Discussion

Acces time

 

Acces time

Can anyone help me how to find files who have been access 5 min ago and older. In hp-ux the find command doesn't have the -amin option like Linux does
5 REPLIES 5
RAC_1
Honored Contributor

Re: Acces time

touch -ct "time_5_mins_ago" "file_name"

find . -type f ! -newer "file_created_above"
There is no substitute to HARDWORK
Mel Burslan
Honored Contributor

Re: Acces time

unfortunately n -amin option.

you need to touch a file with the date/time stamp of 5 minutes ago and use the "-newer c a"
option.
________________________________
UNIX because I majored in cryptology...
Mel Burslan
Honored Contributor

Re: Acces time

or was it "-newerac" ? I never get this straight without trial and error.

the man pages says this :

-newer[tv1[tv2]] file True if the indicated time value (tv1) of the
current file is newer than the indicated time
value (tv2) of file. The time values tv1 and
tv2 are each selected from the set of
characters:
a The time the file was last accessed
c The time the inode of the file was
last modified
m The time the file was last modified

If the tv2 character is omitted, it defaults
to m. Note that the -newer option is
equivalent to -newermm.
________________________________
UNIX because I majored in cryptology...
Tim Nelson
Honored Contributor

Re: Acces time

the stat system call and the time_t ro st_atime value

time_t st_atime; /* Time of last access */

info returned should give you something to work with. i.e. current time - time_t etc..etc..

You will have to use "C" or perl.

I would assume as soon as you access with file with stat to check the access timethen the access time will change to current, just like the find command does.



RAC_1
Honored Contributor

Re: Acces time

I forgot access time thing. you need command as follows.

find . -type f ! -newera "file_created_above"
There is no substitute to HARDWORK