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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting the correct ctime for a file on Windows 10
by Corion (Patriarch) on Jul 05, 2018 at 18:30 UTC | |
by Peppe757 (Initiate) on Jul 08, 2018 at 11:44 UTC | |
|
Re: Getting the correct ctime for a file on Windows 10
by Veltro (Hermit) on Jul 05, 2018 at 20:24 UTC | |
by Anonymous Monk on Jul 06, 2018 at 02:25 UTC | |
by Peppe757 (Initiate) on Jul 08, 2018 at 11:48 UTC | |
by Anonymous Monk on Jul 07, 2018 at 07:07 UTC |