Get_File_Path
See Also: File I/O Commands, File_Exist, Get_Directory, Make_Directory, Make_Temp_File, Remove_Directory, Valid_Drive
Purpose
To return the path (among those listed in DF_OPEN_PATH) for a specified file.
Syntax
Get_File_Path {file-name} to {variable}
Argument Explanation
- file-name: The name of the file for which the path is to be returned.
- variable: A String variable to contain the path to
file-name.
What It Does
The DFPATH (retrieved using the DF_OPEN_PATH attribute) value in the Registry is a list of folders that the system searches to find files. The Get_File_Path command searches the folders in the DFPATH key and returns the full path (including the file name) for the first occurrence of the specified file-name.
Example
Procedure Test
String sPathHello sPathFileList sPathInvt
Get_File_Path "Hello.Txt" to sPathHello
Get_File_Path "Filelist.Cfg" to sPathFileList
Get_File_Path "Invt.Dat" to sPathInvt
Send Info_Box "Hello.Txt was found at " sPathHello
Send Info_Box "Filelist.Cfg was found at " sPathFileList
Send Info_Box "Invt.Dat was found at " sPathInvt
End_Procedure
Notes
- If the file is not found, the return value is an empty string.