There is the currfile package which gives you the file name and relative path of the current input file.
Since v0.6 from 2012/05/06 it is also possible to get absolute paths if the document is compiled with the -recorder argument. Note that this argument is already used by latexmk, so if you are using it there is no extra effort.
The simplest way is to load currfile with the abspath option:
% Compile with: (pdf|xe|lua|)latex -recorder filename
% Needs two runs with MiKTeX, one with TeX Live
\documentclass{article}
\usepackage[abspath]{currfile}[2012/05/06]
\begin{document}
% These macros will show the data of the current
% input file, i.e. inside an \input file they will
% show different values
Absolute directory: \currfileabsdir
Absolute path: \currfileabspath
\end{document}
See the manual for all other provided macros (file base name, extension, etc.) if you also have need for them.
If you don't need the full functionality of currfile (which will update several macros for every input file), then you can use the sub-package currfile-abspath directly:
% Compile with: (pdf|xe|lua|)latex -recorder filename
% Needs two runs with MiKTeX, one with TeX Live
\documentclass{article}
\usepackage{currfile-abspath}
\getmainfile % get real main file (can be different than jobname in some cases)
\getabspath{\themainfile} % or use \jobname.tex instead (not as safe)
\let\mainabsdir\theabsdir % save result away (macro will be overwritten by the next \getabspath
\let\mainabspath\theabspath % save result away (macro will be overwritten by the next \getabspath
\begin{document}
Absolute directory: \mainabsdir
Absolute path: \mainabspath
\end{document}