List files with last access date in linux
Posted
by
kayaker243
on Server Fault
See other posts from Server Fault
or by kayaker243
Published on 2012-11-12T04:02:25Z
Indexed on
2012/11/12
5:02 UTC
Read the original article
Hit count: 567
I'd like to clean up a server that my webmaster let turn into a mess.
I know how to list all files not accessed within the last x days using find and -atime, but what I'm looking for is to come up with a listing of the last access date for files one level down in directory /foo
:
/foo/bar1.txt Dec 11, 2001
/foo/bar2.txt Nov 12, 2008
/foo/bar3.txt Jan 12, 2004
For folders one level down in directory /foo
, list the date of the most recently accessed file within the directory (no limit on depth for identifying last access date)
/foo/bar1/ Feb 13, 2012
/foo/bar2/ Oct 11, 2008
Where /foo/bar1/
has a file modified Jan 1, 1998 and Feb 13, 2012 and /foo/bar2/
has 30 files, most recent of which was accessed Oct 11, 2008.
This question is similar to: http://stackoverflow.com/questions/5566310/how-to-recursively-find-and-list-the-latest-modified-files-in-a-directory-with-s but rather than the modification date, the date of interest is the last accessed date.
© Server Fault or respective owner