Check the Usability of files

Hi All,

I am in the process of collecting data which i need for further analysis and taking necessary actions.

Can i check when a certain file was used last time.

How can i differentiate that usage and creation is different in Unix.

I have log files but those are huge in size not sure how to take out that information out of them exactly.

Any help would be appreciated.

Regards

Karan

ls -ul FILENAME

The creation time is not stored on Unix systems. You can check the time the file was last modified. It is the default date given with ls -l.

Thanks a very quick question on the above...i have a folder in which there are many type of file types...

I want to know which files were not used since 1 May, 2008.

Can you help me with that???

Thanks

Karan

If your find has the -atime switch, try using that.

Era,

I checked with man find and its showing -atime as an option. Can you help with the Syntax for the above you mentioned.

I am looking for all file types which are not used since 1May, 2008 in a particular directory.

Thanks

Karan

Sorry for above confusion..i am not only just looking for the file types ...i am also looking for the entire file name as well whichever file type it might be

Thanks

Karan

The find command has no switches (it has operands), and all versions have the -atime operand.

:slight_smile:

Lol, is this hairsplitting? Do you know all finds that exist in the world? Sure, it is obvious that all should have -atime, but how can we really know?!. :wink: :smiley:

-atime is a switch, what it follows I'd call an operand or parameter. Never heared it different nor read it in a book.

Can someone please provide the solution with the find command

ok.. this is one method..

First evaluate the number of days between the days using the script below..

D1=`date +%s -d "2007-12-19"`
D2=`date +%s -d "2008-02-09"`
((diff_sec=D2-D1))
echo - | awk -v SECS=$diff_sec '{printf "Number of days : %d",SECS/(60*60*24)}'

Then fire the following command...

find . -atime $Diff

where $Diff is the variable which contains diffrence between two dates

hope this helps.. Tweak the script as per your need...

it is giving me this error while running

date: 0551-402 Invalid character in date/time specification.
Usage: date [-u] [+"Field Descriptors"]