in reply to How to determine the last modified date for a directory?

You can do it with the -M file test operator which returns result in floating point decimal days.

$dir = "c:/windows"; $age = -M $dir; print "Dir $dir was last modified $age days ago\n"; # make a new dir just for fun $dir = "c:/foo"; mkdir $dir; $age = -M $dir; print "Dir $dir was last modified $age days ago\n"; rmdir $dir; # delete this test dir

With a dir the concept of modification is a little nebulous - it is actually the days since it was created.

Replies are listed 'Best First'.
Re: Answer: How to determine the last modified date for a directory?
by tachyon (Chancellor) on Aug 01, 2001 at 20:23 UTC

    You have these options available for dir and age tests:

    -d True if file is a directory -M Age of file in days when script started. -A Same for access time. -C Same for inode change time.