There are plenty of ways to create multipage tiff files, but I couldn't find a low effort way to take a large number of folders full of single page tiffs and convert each to a multipage tiff. The following is a batch script which will call
IrfanView to do this recursively. Place the script in the root folder which contains the subfolders of tiffs. The result multipage tiffs will be created in the root folder named by folder.
Be aware that be that this is accomplished by
appending pages. So running the script again while the output files are still in the root folder will lead to a seconds set of images appended to the same multipage tiff.
@echo off
REM http://www.robvanderwoude.com/variableexpansion.php
REM use ! instead of % for delayed variable expansion in for loops
setlocal enabledelayedexpansion
REM Pitfalls of multiline syntax:
REM http://stackoverflow.com/a/2258489
for /R %%a in (*.tif) do (
REM For and file variable syntax:
REM http://www.robvanderwoude.com/ntfor.php
echo Single page tiff: %%~a
set joined=%%~pa
REM Replace path slashes with dashes:
REM http://www.dostips.com/DtTipsStringManipulation.php#Snippets.Replace
set joined=!joined:\=-!
REM Remove both ends:
REM http://www.dostips.com/DtTipsStringManipulation.php#Snippets.RemoveBothEnds
set joined=!joined:~1,-1!
REM add root path and extension
set joined=%cd%\!joined!%%~xa
echo Appended to: !joined!
REM https://irfanview-forum.de/showthread.php?t=345
"C:\Program Files (x86)\IrfanView\i_view32.exe" %%a /append=!joined! /killmesoftly /silent
)
pause