Apparently, the real answer is simply to call stat on the directory path (and not in the directory descriptor, as many examples you might believe) (at least for windows).
Example:
my $directory = "C:\\windows"; my @stats = stat $directory; my $modifiedTime = $stats[9];
if you want to convert it to local time you can do:
my $modifiedTime = localtime $stats[9];
if you want to do all this in one line you can do:
my $modifiedTime = localtime((stat("C:\\Windows"))[9]);
On the one hand, the Perl Win32 UTCFileTime module has a syntax error that prevents the perl module from being interpreted / compiled. This means that when it is included in a perl script, the script will also not work properly. When I combine all the actual code that does something in my script and repeat it, Perl eventually runs out of memory and execution stops. In any case, the answer is higher.
source share