A more accurate Windows command prompt DIR modified time
Asked Answered
Q

3

11

Is it possible to view the last time a file was modified in Windows command prompt in milliseconds or even in seconds?

Quilting answered 27/2, 2013 at 13:25 Comment(1)
Do you really mean DOS, or do you mean via a command prompt or batch file in Windows?Cephalometer
P
8

There is no native Windows command line utility that supports viewing time stamps with a resolution of milliseconds.

Your best option would to either use a 3rd party tool or for a native solution (Vista+), use robocopy (supports seconds):

robocopy /L /TS . ..

Tracking a resolution finer than seconds might be trivial or useless as well depending on the file system being used. See http://msdn.microsoft.com/en-us/library/windows/desktop/ms724290(v=vs.85).aspx and http://jpsoft.com/help/index.htm?timestamps.htm

FAT has a write time resolution of 2 seconds.

Preconize answered 27/2, 2013 at 18:14 Comment(1)
The robocopy /L /TS . .. command works with files to show the timestamp to the second, but it doesn't work with folders/directories :(. Update, thanks to stackoverflow.com/users/479574/mark: forfiles /c "cmd /c echo @path @fdate @ftime".Oneill
H
12

The robocopy answer does work, but another nice option that works from the standard Windows console (not DOS per se):

forfiles /c "cmd /c echo @file @ftime"

Haddad answered 5/5, 2016 at 18:50 Comment(2)
Not DOS at all.Exasperation
The original question before editing asked about DOS prompt, hence the clarification that it didn't technically answer the question, but it did answer the intention.Haddad
P
8

There is no native Windows command line utility that supports viewing time stamps with a resolution of milliseconds.

Your best option would to either use a 3rd party tool or for a native solution (Vista+), use robocopy (supports seconds):

robocopy /L /TS . ..

Tracking a resolution finer than seconds might be trivial or useless as well depending on the file system being used. See http://msdn.microsoft.com/en-us/library/windows/desktop/ms724290(v=vs.85).aspx and http://jpsoft.com/help/index.htm?timestamps.htm

FAT has a write time resolution of 2 seconds.

Preconize answered 27/2, 2013 at 18:14 Comment(1)
The robocopy /L /TS . .. command works with files to show the timestamp to the second, but it doesn't work with folders/directories :(. Update, thanks to stackoverflow.com/users/479574/mark: forfiles /c "cmd /c echo @path @fdate @ftime".Oneill
O
2

Another user wrote "There is no native Windows command line utility that supports viewing time stamps with a resolution of milliseconds." That is incorrect. Run either of the two wmic commands on a file in an NTFS filesystem and you will see the timestamp to the accuracy of millionths of a second (microsecond which is shorter/smaller than millisecond):

For file type = file:

G:\>wmic datafile where Name="G:\\c\\m\\d\\file.jpg" list /format:list
AccessMask=2032127
Archive=TRUE
Caption=g:\c\m\d\file.jpg
Compressed=FALSE
CompressionMethod=
CreationClassName=CIM_LogicalFile
CreationDate=20141109222121.770365-420
CSCreationClassName=Win32_ComputerSystem
CSName=LENOVO
Description=g:\c\m\d\file.jpg
Drive=g:
EightDotThreeFileName=g:\c\m\d\file.jpg
Encrypted=FALSE
EncryptionMethod=
Extension=jpg
FileName=file
FileSize=737719
FileType=JPEG Image
FSCreationClassName=Win32_FileSystem
FSName=NTFS
Hidden=FALSE
InstallDate=20141109222121.770365-420
InUseCount=
LastAccessed=20200909172756.711862-360
LastModified=20140817192345.000000-360
Manufacturer=
Name=g:\c\m\d\file.jpg
Path=\c\m\d\
Readable=TRUE
Status=OK
System=FALSE
Version=
Writeable=TRUE

For file type = file folder / directory:

E:\>wmic FSDIR where Name="D:\\a\\b\\c\\folder" list /format:list
AccessMask=2032127
Archive=TRUE
Compressed=FALSE
CompressionMethod=
CSName=RPM-HP14-BW012N
Description=d:\a\b\c\folder
Drive=d:
EightDotThreeFileName=d:\a\b\c\folder
Encrypted=FALSE
EncryptionMethod=
Extension=
FileName=folder
FileSize=
FileType=File Folder
FSName=NTFS
Hidden=FALSE
InstallDate=20141109221702.051899-420
InUseCount=
LastAccessed=20200921013720.883985-420
LastModified=20200919161912.763540-420
Name=d:\a\b\c\folder
Path=\a\b\c\
Readable=TRUE
Status=OK
System=FALSE
Writeable=TRUE

20141109222121.770365-420 = 2014-11-09 22 hours 21 minutes 21 seconds 770365 microseconds 420 minutes different from UTC time.

10 millionths of seconds: See https://superuser.com/questions/937380/get-creation-time-of-file-in-milliseconds which has text generated by a different method - "[File] Birth [time]: 2015-03-29 22:16:50.080654200 +0100". "080654200" shows the amount of nanoseconds (080,654,200) or the amount of tenths of microseconds (0,806,542).

Wikipedia says: NTFS Date resolution = 100 ns - https://en.wikipedia.org/wiki/NTFS

Oneill answered 21/9, 2020 at 19:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.