0

Following Windows batch command converts all tif images in the folder C:\RootFolder\Folder1.

for %%i in (C:\RootFolder\Folder1\*.tif) do "Tiff2Pdf.exe" -o C:\RootFolder\Folder1\%%~ni.pdf %%i

How can I do it for all the folders available in RootFolder?

RootFolder
  -Folder1
  -Folder2
  -Folder3
   .
   .

Thanks for your time

2 Answers 2

1

There's another way - just to add it:

@echo off
for /r "c:\rootfolder\folder1" %%a in (*.tif) do "Tiff2Pdf.exe" -o "%%~dpna.pdf" "%%a"

I also changed the loop variable to a because i is close to l and I and 1 in many fonts.

Sign up to request clarification or add additional context in comments.

Comments

0
FOR /F "delims=" %%i IN ('dir /b /s C:\RootFolder\Folder1\*.tif') DO "Tiff2Pdf.exe" -o "%%~dpi%%~ni.pdf" "%%i"
  • Use dir /s /b to do a full recursive enumeration
  • Use FOR /F "delims=" to parse the results and handle paths with spaces.
  • Use the %%~dpi%% to get the directory of each file.
  • Use %%~ni to get the file's name with out an extension.

2 Comments

Thanks. It works, but only when "delim=" is removed.
Thanks. I fixed a typo. It should be "delims=" not "delim="

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.