[OS X TeX] batch file renaming

Justin C. Walker justin at mac.com
Tue Apr 18 05:04:30 CEST 2006

On Apr 17, 2006, at 19:34 , Themis Matsoukas wrote:

> ...this is not entirely OT:
> I want to rename a bunch of files from foo.EPS to foo.eps, so that  
> I can open them in TeXShop and save them as pdf. What's a quick way  
> to do it? I could open the files in Preview and save them as pdf  
> but it prompts me each time where I want the pdf saved and that's a  
> chore, since I have quite a few files to convert. On the other  
> hand, TeXShop saves the pdf file automatically making the  
> conversion easier, except that it does not recognize the  
> capitalized extension .EPS. Hence my need for a quick way to rename  
> files. I found a script in Library/Scripts/Finder Scripts/ that  
> almost does what I wanted, but I had to change the extension first  
> from .EPS to .whatever and then to .eps.
> Is there a more elegant way?

Depends on what you mean by 'elegant' :-}  For me, this fills the bill:

I'm using 'bash' as my shell, and there is a way to do the same thing  
in tcsh/csh:

for i in  *.EPS
echo === $i ===
j=`basename $i .EPS`
mv $i $j.eps

The quotes around the 'basename' command are "back quotes" (location  
depends on keyboard; I'm not sure they are on every keyboard).

The 'echo' command is just to verify what files are being modified,  
so when something goes wrong :-}, I can figure out what and where.



Justin C. Walker, Curmudgeon-at-Large
() The ASCII Ribbon Campaign
/\ Help Cure HTML Email

------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/

More information about the macostex-archives mailing list