Mmmmmm... I think I understand what you are wanting but the solution isn't straight forward.

It involves the use of the "Dir" function but also the use of recursion.

It sounds like you will always have a BASE directory to start looking in (ie c:\windows\temporary internet files\) but there will be subdirectories under it and you want to find the ACTUAL subdirectory the filename in question belongs to.

What you need to do is start by looking at the contents of the directory you know and if the file isn't found then you need to repeat the proceedure for each directory you discover beneath that one.

Its a start... if I had time to code it out I would