I am trying to get the creation date and time of a specific folder in Windows. Based on this answer, I have tried the following:
@echo off
set path_of_folder="C:\folderA\folderB\"
if exist %path_of_folder% (
echo Path exists.
for /f "skip=5 tokens=1,2 delims= " %%a in ('dir /a-d /tc %path_of_folder%') do set "dt=%%a"
echo Created on: %%a, %%b
)
)
else (
echo Path does not exist.
)
pause
Where I get this output:
Path exists.
Created on: 05/07/2017, 17:42
Created on: 05/07/2017, 17:42
Created on: 05/07/2017, 17:42
Created on: 05/07/2017, 17:42
Created on: 4, File(s)
Created on: 0, Dir(s)
Which I am sure it shows the creation dates for each of the files (4 for my example) inside the folderB
.
I am looking on saving the creation date and time only for the top folder folderB
; can anyone suggest/show how this can be achieved and not get all the other creation date/times as well?
Note that on the answer given on the attached link, there is a exit /b 0
right after the echo Created on: %%a, %%b
command which I cannot add on my script since there are several other commands I want to execute after I get the system date and time.