how to make a batch file that only writes down image names from a certain size

Viewed 26

I need to have the names of images that are above a certain file size, so i can replace them with smaller sized images. I already used the following code to retrieve all of the names but now I only want the names of large images.

(FOR %%f IN (*.*)DO @ECHO %%f; )> myfiles.txt
2 Answers
@(
 FOR %%f IN (*.*) DO (
  IF %%~zf GTR 100000 (
    (ECHO(%%f;)
  )
 ) 
)> myfiles.txt

mind that %%~zf will expand the size in bites.

Example for files >=1MB:

(FOR %%f IN (*.*)DO @IF %%~tf GTE 1048576 ECHO %%f; )> myfiles.txt
Related