Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Batch conversion of a bunch of Illustrator files to SVG files



Dave M G writes:

 > What I want to do is basically crawl my whole home directory
 > (/home/dave) looking for .ai files and convert them to .svg files. Will
 > the script you offered go down into subdirectories?

Yes.  That is precisely what find is for.

 > And have I incorporated the find syntax correctly? I put single quotes
 > around what I'm searching for, and back-ticks around the whole find command.

That is correct.

 > #!/bin/bash
 > for i in `find -name '*.ai'`; do
 >     uniconverter input ${i} output ${i%.ai}.svg
 > done

However, you are on your own for the syntax of the "uniconverter"
command; I don't know if that is correct.

jep points out the possibility of names with spaces (or even more evil
things) in them.  I *think* that putting double (not single!) quotes
around the variable references will handle that case, eg, "${i}".

I also follow his advice regarding use of the echo command regularly.
Shell quoting is very hard to get correct, and it's typically easier
to try a few variations on the data you're actually using, and only
RTFM it when steam starts wafting out of your ears.  There are a bunch
of gotchas with echo, though (for example, the double quotes I suggest
for the variable references will get eaten when the shell evaluates
the echo command; that's OK but may be a little disconcerting if
you're not expecting it).


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links