Reputation: 1
I am automating folder creation by finding out last created
Steps:
In my case, it is reading as:
test1,test11,test12,..test2,test21,..test3
When i arrange folders by name and I write the code to arrange the code by last updated, it is giving last commited folder as I am checkout the code from svn.
for /f "delims=" %%A in ('dir /ad /b /od') do set lastfolder=%%A
echo %lastfolder%
Upvotes: 0
Views: 40
Reputation: 5372
for /f "delims=" %%A in ('dir /ad /b /od /tc') do set lastfolder=%%A
echo %lastfolder%
Those dir
settings are giving me last modified. If you want last created, then add the argument /tc
to change timefield to creation.
For cmd prompt, change %%A
to %A
.
See dir /?
.
Upvotes: 1