for do if

  • Thread starter Thread starter j4e8a16n
  • Start date Start date
J

j4e8a16n

Hi everybody,

I have many images in a folder and I want to delete 4 files every
five files . That is to say keeping only one fift of the images
files.


set a=0
for /r %i in (*.png) do if %a% LSS 5 (set /a a+=1 & del "%i" ) else
(set /a a=0)

The variable a does not seem to be set to zero has if %a% keeps
increasing

Thanks for yur attention,

J
 
Back
Top