#!/usr/bin/perl -w use strict; #use diagnostics; use warnings; use POSIX; my $file = $ARGV[0] || 'a.pl'; my @t = stat($file); print "Accessed: ", strftime("%A, %B %d, %Y, %H:%M:%S",localtime($t[8] +)), "\n"; print "Modified: ", strftime("%A, %B %d, %Y, %H:%M:%S",localtime($t[9] +)), "\n"; print "Created: ", strftime("%A, %B %d, %Y, %H:%M:%S",localtime($t[10] +)), "\n";
Update: added dir and last modified above, emphasized 'on Win32'
Update 2.5: Okay, thunders made me curious. I dug into the perl source. Perl's stat (built with Visual C) is implemented using the stat or wstat function. According to MS, these functions return st_ctime, which is the "Time of creation of file. Valid on NTFS but not on FAT formatted disk drives." This is what stat[10] returns.
Also, if you move a file across file systems (from c: to d:, for example) the creation time changes.
In reply to Re: How to find the create time of a file under MS
by jsprat
in thread How to find the create time of a file under MS
by demerphq
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |