As Walter Roberson mentioned, this is impossible with dir(). One could use Jan's solution though that was not appropriate in this case. I ended up using shell.
using dir() to get timestamp of file with ms precision
3 次查看(过去 30 天)
显示 更早的评论
Hi there,
I am looking to extract the timestamp (specifically, the "modification date") of some files in a folder. If I use dir(), then I can get the modification date in either datetime or datenum format. However, both of these give the timestamp to second precision, but I know the actual timestamp has millisecond precision. I want that millisecond precision. Is there any way to get the timestamp with millisecond precision using dir()? If not, how can I do this?
Thanks in advance!
0 个评论
采纳的回答
更多回答(1 个)
Jan
2018-10-2
7 个评论
Jan
2018-10-4
编辑:Jan
2018-10-4
@supernoob: The function GetFileTime can reply the time in the native format as stored in the file system as UINT64 counted in steps of 100ns. Then you can convert this how ever you like it.
The C-Mex function uses the Windows library function FileTimeToSystemTime, which rounds to milliseconds.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!