Pradeep
Pradeep

Reputation: 3468

Using batch file I need to know the latest folder name in the particular location

I have a network location from where I need to know the name of latest folder created. This I want to do using batch file. Any help will be great

Upvotes: 3

Views: 4679

Answers (1)

Pradeep
Pradeep

Reputation: 3468

I was able to do this by the following way:

@echo off

for /f "tokens=*" %%A in ('dir "<directory name>" /AD /O-D /B') do (set recent=%%A& goto exit)

:exit
echo %recent%

Any better solution can be good.

Upvotes: 5

Related Questions