Code: Select all
for /F "delims=" %%a in ('dir "a:\" /a-d /b /s') do (
set "size=..............................%%~za"
call set ".%%size:~-30%%:%%a=%%a %%~za"
)
(for /F "tokens=1* delims==" %%a in ('set .^|sort /r') do echo %%b) >%MYFILES%\outfile2.txt
Suppose you have 2 files, both size 20, named "A:\TEST=A.TXT", and "A:\TEST=B.TXT" -
There can only be one variable named ".............................20:A:\TEST"
Even if you only have one file size 20 with name "A:\TEST=A.TXT" -
The variable name will be ".............................20:A:\TEST" and the value will be "A.TXT=TEST=A.TXT 20".
The output will be the same as the value. The value you want is "TEST=A.TXT 20"
I used to avoid the use of temp files. But I've since learned that they are frequently the best option. Often times the temp file solution is easier to code and significantly faster.
Dave Benham