Here is the solution..
You can just go to the folder by writing the path cd / d Result
setlocal enabledelayedexpansion
cd /d Result
set "count=1000"
set a="*.jpg"
for /f "usebackq delims=*" %%f in (`dir /b /o:-d /tc %a%`) do (ren "%%f" file-!count:~1!.jpg
set /a count+=1
)
pause
SetLocal EnableDelayedExpansion Expansion of variables through signs (!)
cd / d Result go to the Result folder
set "count = 1000" variable in which I marked the number of zeros file-001.jpg
set a = "*. jpg" the variable indicates which files we are looking for.
(dir /b /o:-d /tc %a%
)
dir - Displays a list of files and subdirectories. Next, we sort.
/b - Display only filenames.
/o:-d - Sorts the list of displayed files in reverse order (newest to oldest).
/tc - Sort by file creation time.
%a% - Call the variable.
usebackq Sets the ability to use quotes for filenames Like this> ".
Specifies the execution of a string, enclosed in back quotes, as commands Like this> `,
and strings in single quotes are like commands in a character string Like this> '.
delims = xxx Specifies a set of delimiters. Overrides the default space-tab delimiter set.
"
s around the second%%f