Page 1 of 1

Search images in subfolders and convert

Posted: 2018-10-29T04:14:24-07:00
by keljnr
I have put together a simple script, which when used on the direct parent folder of the files, works fine:

Code: Select all

cd %~dpnx1
for %%a in (.) do set currentfolder=%%~na
magick "*jpg*" "*png*" "*tif*" "%currentfolder%.pdf"
It searches for jpg, png and tifs in a folder and converts to a pdf, renaming it as folders name.
Now how would I go about doing the same thing, but searching through various subfolders, instead of the direct parent?

Example:

Folder Top (<- search through this folder)
- Sub Folder A
- image_1.jpg
- image_2.jpg
- Sub Folder B
- image_3.tif
- image_4.tif
- Sub Folder C
- image_5.png
- image_6.png

So this should end up in three pdfs: Sub Folder A, Sub Folder B and Sub Folder C


I do hope that makes sense. Many thanks

Re: Search images in subfolders and convert

Posted: 2018-10-29T06:51:11-07:00
by snibgo
You should always say what version of IM, on what platform. You seem to be using Windows BAT scripts.

I suggest you look at, and experiment with, "for /R".