I have tried it this way to place a list in each folder using this code
@For /D %%I In ("c:Temp*")Do @(For %%J In ("%%I*.rts")Do @Echo %%~nxJ)>"%%I%%~nxI.txt"
worked fine but i couldn’t get it to list from largest to smallest in order to remove the first one and delete the rest.
so can it be fixed or is there an easier way.
Source: Windows Questions