We can find creation date of a file from command line using dir command. The syntax for this is given below.
dir /T:C filename
If we need to get file creation date and time for all the files and subdirectories in the current directory, the command is:
dir /T:C
We can also restrict the output to specific file types using wildcards.
dir /T:C *.pdf
The above command would print file creation dates only for pdf files.
Command to print file creation date and time only for files(skip directories)
dir /A:-D /T:C
Find the latest created file in a directory:
The below command would print the files in the order of creation date & time. In this list the file that is created very recently would be displayed in the last position.
dir /A:-D /T:C /O:D
Example:
C:\>dir /A:-D /T:C /O:D 02/06/2012 07:38 PM 4 4.txt 02/06/2012 07:39 PM 0 5.txt 02/06/2012 10:45 PM 13 10.txt 02/06/2012 10:47 PM 13 newfile.t 02/11/2012 08:24 PM 83 2.bat 02/11/2012 08:26 PM 5,219 data.txt 02/11/2012 08:27 PM 5,219 data2.txt 02/12/2012 11:28 PM 98 3.bat 02/13/2012 10:47 AM 131 echo.bat
{ 0 comments… add one now }