How do I get the directory of a file that is not in the current directory?
Printable View
How do I get the directory of a file that is not in the current directory?
Where are you getting the filename from (what function)? This will help us decide how to get the full path.
if you don't know where the file is you will have a problem since a file name on it self isn't unique, only the full path of the file is unique.
if you know where te file stands you can do the following
getcurrentdirectory, to save the current path
setcurrentdirectory to switch to the directory where the file is
add the currentdirectory and the filename together to make the full path
setcurrent directory to the directory you saved