Using imagemagick to identify all files in multiple subfolders

Solution 1:

You could just run a FOR /F loop with a DIR command to get the full explicit path to each file from the source directory (D:\Images) and traverse it recursively.

This essentially passes each full explicit path and file name to the magick command one-by-one and then you will append these to the log file for later review.

Additional resources and an example command with applicable syntax using all this is provided for you below to utilize accordingly. This should be a good starting point for you.


Command Line Example

NOTE:You can replace the portion of D\Images\*.*" as D\Images\*.jpg" or whatever file extensions to only list those particular file extensions and you could also change it to F:\OtherFolder\*.png" or whatever for the need so a different folder path and/or file extensions can be specified in that portion of the example I provided below.

FOR /F "DELIMS=" %A IN ('DIR /A-D /S /B "D:\Images\*.*"') DO magick identify -verbose "%~A">>D:\logfile.txt

Batch Script Example

NOTE:I made this script so you can set the variables for your needs up top easily to accommodate accordingly per run.

@ECHO ON

SET Source=D:\Images
SET Ext=*.jpg
SET LogFile=D:\logfile.txt

FOR /F "DELIMS=" %%A IN ('DIR /A-D /S /B "%Source%\%Ext%"') DO magick identify -verbose "%%~A">>"%LogFile%"
GOTO EOF

Further Resources

  • FOR /F
  • DIR
  • Escape Characters, Delimiters and Quotes
  • Redirection