📎 AI Summary:
The thread discusses methods to retrieve exact timestamp attributes of files and folders in Windows. The original poster asks about obtaining folder timestamps using command-line tools, as WMIC works only with files. Respondents recommend using PowerShell, which offers more straightforward and flexible commands—highlighting that PowerShell can easily access detailed timestamp information for both files and folders, with the original poster sharing a practical example of listing multiple timestamp attributes in a table format. Overall, the consensus favors PowerShell as the most efficient solution.

xio

Senior Member
Member details
Joined
Jun 28, 2022
Messages
25
Thread Author #1
To get the exact time stamp attribute of a file in the command prompt, I use:

Code:
wmic datafile where name="D:\\test1.txt" get LastModified

Using WMIC is necessary because the dir command can only show minutes. However, wmic datafile only works on files, not folders. I paid attention to using both the quotation marks and the two backslashes rather than one after the drive letter and the colon.

Is there any way to achieve this on folders?
 

Solution
PowerShell is going to be a lot easier and is the preferred method.


You can access any property in multiple ways. As an example if all you want is the lat modified time
Code:
Get-Item -Path C:\folder\or\file\path
(Get-Item -Path C:\folder\or\file\path).LastWriteTime
Thanks, Neemobeer! Conveniently, it also supports wildcard selection.

While I am not all that familiar with PowerShell, I have found a way that can display both file name and the last modified time and the other two time attributes as a table:

Code:
dir * | select name,LastWriteTime,CreationTime,LastAccessTime

Sample output:

Code:
Name                       LastWriteTime       LastAccessTime      CreationTime
----                       -------------...

Neemobeer

Windows Forum Team
Staff member
Member details
Joined
Jul 4, 2015
Messages
8,995
PowerShell is going to be a lot easier and is the preferred method.


You can access any property in multiple ways. As an example if all you want is the lat modified time
Code:
Get-Item -Path C:\folder\or\file\path
(Get-Item -Path C:\folder\or\file\path).LastWriteTime
 

  • Like
Reactions: xio

xio

Senior Member
Member details
Joined
Jun 28, 2022
Messages
25
Thread Author #3
PowerShell is going to be a lot easier and is the preferred method.


You can access any property in multiple ways. As an example if all you want is the lat modified time
Code:
Get-Item -Path C:\folder\or\file\path
(Get-Item -Path C:\folder\or\file\path).LastWriteTime
Thanks, Neemobeer! Conveniently, it also supports wildcard selection.

While I am not all that familiar with PowerShell, I have found a way that can display both file name and the last modified time and the other two time attributes as a table:

Code:
dir * | select name,LastWriteTime,CreationTime,LastAccessTime

Sample output:

Code:
Name                       LastWriteTime       LastAccessTime      CreationTime
----                       -------------       --------------      ------------
example.202211182130.mhtml 18.11.2022 21:30:33 03.12.2022 11:39:06 18.11.2022 21:30:33
example.202211182138.mhtml 18.11.2022 21:38:18 03.12.2022 11:39:06 18.11.2022 21:38:18
example.202211182153.mhtml 18.11.2022 21:53:32 03.12.2022 11:39:06 18.11.2022 21:53:31
example.202211201304.mhtml 20.11.2022 13:04:38 03.12.2022 11:39:06 20.11.2022 13:04:38
example.202211201318.mhtml 20.11.2022 13:18:33 03.12.2022 11:39:06 20.11.2022 13:18:33
 

Solution