A
A
aosvxs7ui2019-03-13 12:00:51
cmd/bat
aosvxs7ui, 2019-03-13 12:00:51

CMD bat how to sort files in a folder by modified date?

I am writing a script that will install the application based on the date of the change.
Let's say I have 4 installation files in my folder and I just uploaded the fifth one. The batch file should install the one that I threw last.
for /f "tokens=* delims=" %%a in ('type temp.txt') do (
for %%b in (%%a) do (
if "%%b"=="something" adb install -r С:\Hello\ (I don't know what to use here)
del temp.txt

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2019-03-13
@aosvxs7ui

You can get a list of files sorted in reverse order by date using the command:
Wrap dir output in for /f and process only the first entry. The first entry in the dir output will be the name of the desired installer.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question