How to strip curly-braces from variable before using it as a filename?

I'm trying to use a variable to pass a filename to \includegraphics. I'm having trouble because my filename is built up from other variables. This leaves an empty curly-brace inside the filename. The filename correctly prints in the document, but the braces cause a "file not found" error in \includegraphics.

(I'm working on a genealogy project with many photographs. The names are generated with a script.)

How can I get LaTeX to strip empty curly-braces from a variable before passing it to \includegraphics?

Many thanks, Kevin

Example Code: filevar.tex

%
% ==============================================================
% Example to show problem with building filenames from variables
%
% Current directory contains:
%    + This LaTeX source file (filevar.tex)
%    + A directory named "photos"
%    + JPEG photo photos/t-0001_FirstPhotoName.jpg
%    + JPEG photo photos/t-0002_SecondPhotoName.jpg
%
% This file is processed with the command
%    pdflatex -interaction=batchmode filevar.tex
%
%    The error messages are:
%    LaTeX Warning: File ./photos/t-00{}01_FirstPhotoName.jpg' not found on input

%
\documentclass[letterpaper,twoside]{article}

\usepackage{graphicx}
\graphicspath{{./}{./photos}}

%
% Here is the macro I want to fix.
\newcommand{\pfile}[1]{%
%\catcode_=12 % --does not work inside macro
Here is the example for file \texttt{#1}.
\newline
\includegraphics[height=0.40in,width=0.55in,keepaspectratio=true]{./photos/t-#1}
\newline
}%

% These variables are generated programmatically...
\def\photoSerialNumberBase{00}
\def\photoSerialNumberFirstPhotoName{\photoSerialNumberBase{}01}
\def\photoSerialNumberSecondPhotoName{\photoSerialNumberBase{}02}

\begin{document}

\title{Problem Example: Variables and Filenames}
\author{Kevin Cundiff}
\date{\today}
\maketitle
\pagenumbering{arabic}

Lots of important and earth-shaking text goes here.

% This cryptic command disables the special meaning of '_'.
% This allows underscores to be used in a filename.
\catcode_=12 % --does work inside environment!

Just below this paragraph, I would like to place the thumbnail for
several photos. The filename is generated using variables. This leaves
a set of empty curly-braces in the middle of the filename which prevent

How can I tell \LaTeX{} to strip empty curly-braces from the variable?
Many thanks!

\pfile{\photoSerialNumberFirstPhotoName_FirstPhotoName.jpg}

\pfile{\photoSerialNumberSecondPhotoName_SecondPhotoName.jpg}

\end{document}

-
you could strip the braces but why have you put them in? If you went \def\photoSerialNumberFirstPhotoName{\photoSerialNumberBase 01} there would be no {} to remove. – David Carlisle Aug 6 '12 at 22:15
Thanks for your quick response. I thought there was a second problem with another macro (one I hadn't included in the example). But once I removed the {} then it worked like a charm. – Kevin Cundiff Aug 7 '12 at 2:05
OT: Rather than changing the global catcode of _ (which will cause troubles in the math environments), it is better to use the underscore package. – Aditya Aug 7 '12 at 3:03

\def\photoSerialNumberFirstPhotoName{\photoSerialNumberBase 01}

there would be no {} to remove.