Welcome to the Monastery | |
PerlMonks |
Getting the correct ctime for a file on Windows 10by Peppe757 (Initiate) |
on Jul 05, 2018 at 18:20 UTC ( [id://1217973]=perlquestion: print w/replies, xml ) | Need Help?? |
Peppe757 has asked for the wisdom of the Perl Monks concerning the following question: I have a perl script on my Windows 10 machine that renames JPG files with the ctime of the file. I am using Strawberry Perl. In my script, I use the stat function to get the file stats, but the ctime is not always correct. For example, for one of my files the script returns the following values (formatted as yyyymmdd_hhmmss): atime = 20180628_213727 mtime = 20180623_222846 ctime = 20180628_213727 However, when I look at the file information in the Windows 10 window manager, the datetime shown is "5/27/2018 8:33 PM", which I know to be the correct date when the photo was taken. For the vast majority of my files, the stat function returns the correct ctime, but for a few files, the ctime value has somehow become corrupted; but even in these cases, the window manager still shows the correct date, so it must be available somewhere in the file. My question is, How can I access from my perl script the file datetime displayed by the window manager? Also, I thought about using the system function with the DOS "dir /T C" command, but when I checked in a Command Prompt window, it returns the same value as the perl stat function. Thanks.
Back to
Seekers of Perl Wisdom
|
|