I have many archive folder which stores the backup files. each folder increases daily.
I need to delete all files except for recent N copies in each of them, N was defined by a variable from the parent loop.
%%a is a number from parent loop, then use another for loop to delete
for /F "usebackq skip=%%a" %%x in (`dir /TW /O:-D /B %%b`) do del %%x
The error reports
%a" was unexpected at this time.
How to fix this?