in reply to How to find the create time of a file under MS
#!/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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How to find the create time of a file under MS
by thunders (Priest) on Jul 16, 2002 at 15:54 UTC | |
|
Re: Re: How to find the create time of a file under MS
by demerphq (Chancellor) on Jul 17, 2002 at 09:44 UTC | |
|
Re: How to find the create time of a file under MS
by Anonymous Monk on Jun 14, 2004 at 13:48 UTC |