Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding dirs not accessed in 3 yrs

Status
Not open for further replies.

yowza

Technical User
Nov 28, 2001
121
US

I would like to find all directories in a filesystem that has not been accessed in 3 or more years and print them to a file. I've read the man pages for find, and used the -mtime option but it does not seem reliable. It will find the directories dated 1998 (for example) but when I go into the sub-directories I can somtimes find files dated within the 3 years. Does anyone have a script or a variation of the find command that will help me out?

Thanks!
 
Are you looking for files or just directories ? You could have directories with a modification time older than 3 years, but still containing recently modified files.

If you are looking for modification dates of directories and files :-

find / -mtime +1095 | xargs ls -al

Or for access dates :-

find / -atime +1095 | xargs ls -alu

Where 1095 represents 3 years 3x365



 
But remember that:

-atime n True if the file was accessed n days ago. The
access time of directories in path is changed by
find itself.

This could affect the veracity of any future finds done on the same path. HTH.
 
Thanks trunix and ken for the responses. I definately do not want to change the access/modifcation time of anything. My situation is that I inherited a system that has stuff dating as far back as 1995. I am almost 100% sure that nobody has used this or even knows what it is and am trying to get someone to admit it and let me archive it off. If the find command alters the date, I don't want to use it. I thought the easiest way would be to check the date/time on the directories instead of the files. I have 360gb of data to go thru.

thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top