I'm trying to get the last modified date of a bunch of files on Windows. On GNU systems, I can just use something like stat -c %Y
.
I know about the wmic
command, but the problem with that is that it is very slow. On my system, running the command wmic datafile where Name="..." get LastModified /value
is around 4 to 7 times slower than using a port of GNU stat in an MSYS2 shell.
For my purposes, I need an alternative that is faster and built-in to either Windows itself, or the Visual Studio development tools. I don't really care about the output format because I can parse it manually myself.
Does anyone know if something like that exists?
stat
(search for"stat.exe"
). If not, it's only a few lines of C to write.stat()
orlstat()
, depending on how you want symbolic links handled). Or it's probably straightforward in PowerShell, but I've never used that more than minimally.stat
. You can invoke it withbash -c
, though you will need to use the Linux, not the Windows file name.