Page 1 of 1

Batch file find size and delete or move to temp.

Posted: 21 Aug 2012 12:21
by rajeshcr2000
Hi,
I am very new to batch file scripting :-)

Need help to create the batch file for finding the size and based on the condition the file shluld be deleted or moved to temp location.

Thanks
-Raj

Re: Batch file find size and delete or move to temp.

Posted: 21 Aug 2012 12:30
by Squashman

Code: Select all

for /f "delims=" %%G in ('dir /a-d /b *.txt') do (
   IF %%~zG GEQ 100000 (
      del "%%G"
   ) else (
      move "%%G" C:\temp
   )
)