in reply to Folder modified time

Work on Windows too

>md dir >perl -MFile::stat -le"print ''.localtime( stat('dir')->mtime )" Fri Aug 28 10:14:50 2009 >copy nul dir\file 1 file(s) copied. >perl -MFile::stat -le"print ''.localtime( stat('dir')->mtime )" Fri Aug 28 10:14:50 2009 >perl -MFile::stat -le"print ''.localtime( stat('dir')->mtime )" Fri Aug 28 10:15:06 2009

But it took a second to update.

Replies are listed 'Best First'.
Re^2: Folder modified time
by Crackers2 (Parson) on Aug 28, 2009 at 14:30 UTC

    That test doesn't seem to match his description. That would be more like:

    > md dir1 > md dir1\dir2 > copy nul dir1\dir2\file

    And he's expecting the mtime of dir1 to be updated after the copy.

      The system (NTFS + WinXP) doesn't appear to work that way.

      As you can see, the system says the parent directory (".") was last modified earlier than when the child directory ("dir2") was last modified:

      >dir dir1 Volume in drive C is C Volume Serial Number is 28AB-0E8B Directory of C:\Documents and Settings\ikegami\dir1 2009/08/28 12:43 PM <DIR> . 2009/08/28 12:43 PM <DIR> .. 2009/08/28 12:44 PM <DIR> dir2

      Perl reports the same.

Re^2: Folder modified time
by Utilitarian (Vicar) on Aug 28, 2009 at 15:22 UTC
    Ooh, much easier localtime by stringify, thanks for the technique, again
      Hi All, Thanks for sharing the thoughts. Now i achieved this by using FIle::Find::Rule to collect all the folders and i checked the latest modified time of all folders. but it's not a direct way and i checked for any direct way to find this time to save the script process time.