# How to use epstopdf in batch mode?

The top voted answer to the following question is a really good way to convert eps files to pdf.
What are good ways to convert EPS to PDF?
I really prefer it over ps2pdf because it preserves the size of the image.

However, I am unable to employ it as a batch-conversion tool. The command epstopdf -h yields epstopdf: -h: unknown option and I couldn't find any other options to configure it for a batch mode. I think I will write a small Python script but wanted to use a simpler option.

Edit1: What I am looking for is an option which will be similar to the following command.
epstopdf "C:\path\to\image\folder with spaces\*.eps"

The for loop doesn't work here because of the spaces in the path.

• epstopdf --help – egreg Sep 14 '14 at 21:49
• Thanks! Unfortunately batch-conversion is not an option. :( – Shashank Sawant Sep 14 '14 at 21:50
• do you mean something like for i in *.eps; do epstopdf $i; done – David Carlisle Sep 14 '14 at 21:53 • @HeikoOberdiek Maybe Shashank meant the possibility of doing something like epstopdf *.eps. – egreg Sep 14 '14 at 21:57 • @ShashankSawant for i in *.eps; do epstopdf "$i"; done you need to quote filenames with spaces, that's just general shell syntax, nothing to do with epstopdf – David Carlisle Sep 14 '14 at 22:19

## Windows

Quotes should be used in a Windows command window to protect the spaces:

for %f in ("C:\path\to\image\folder with spaces\*.eps") do epstopdf "%f"


Inside a .bat file, the percent needs to be doubled.

## Linux/bash

Special characters like spaces can be escaped with the backslash in bash:

for f in /path/to/image/folder\ with\ spaces/*.eps; do epstopdf "$f"; done  Alternatively quotes can be used for the spaces. The joker characters should be outside of the quotes. The following example also uses several lines for readability: for f in "/path/to/image/folder with spaces/"*.eps; do epstopdf "$f"
done

• Linux (Bash) version? Thanks. – becko Apr 12 '17 at 14:40
• @becko I have added a version for bash. – Heiko Oberdiek Apr 12 '17 at 16:23