TVS TeX Versioning System.
A Perl script to collect all files which are needed to re-typeset TeX documents. It does it by parsing TeX logs. TVS is able to handle filenames intelligently.
http://www.ctan.org/tex-archive/help/Catalogue/entries/tvs.html?action=/tex-archive/support/