Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Search for a file
Message
From
01/07/1999 14:43:35
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00235414
Message ID:
00236621
Views:
23
>>hello all!
>>
>>I would like to know how i do to dicover the path for a file, where i have only the name from file, by sample i would like to know where is filename.xxx, but i don´t know what is your folder.
>>
>
>You could search for it from the root recursively using something like ADIR(), driling down through the file system until it is found.
>
>If you know a relative path for the file (ie FILE(cFileName) returns .T.), you can retrieve the fully-qualified pathname using FULLPATH(cFileName).

The only problem I have had with using FULLPATH() is that if the file does not exist in the FP path, it just returns the current directory name and path, so it is really important to check for the existence of the file first. And if it isn't in the current FP path, but still on the machine or server, you won't get FILE(xxx) = .T. Also, beware if the same filename exists in more than one place in the FP path, FULLPATH() will only return the fully qualified filename of the first one found... This really drove me nuts on debugging an app a few year ago from another developer who was sloppy about file names and locations....

HTH

Rob
Previous
Reply
Map
View

Click here to load this message in the networking platform