Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FILE() and file at the root
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00529793
Message ID:
00529842
Views:
9
>>>I am using FILE() with a full path and a full file name. It works great unless the file is located directly under the root. FILE('C:\upload.txt') will return .T. as long as upload.txt is in the path. It does not matter that c:\upload.txt does not exist.
>>>
>
>>Brenda,
>>If you need to check for a file in a specific directory, I recommend using >ADIR(). If it returns 0, the file doesn't exist in the specified directory.
>
>Unfortunately I do use FILE() and this is production code. I am not in a position to put in a new release. Is this known behavior of FILE()?
>
>Guess I could have the client's mapping to the folder moved up a level so that instead of FILE('h:\upload.txt') it would be FILE('h:\ampm\upload.txt') then it would work.
>
Brenda,

Yes, it is. The if the file exists on the VFP path, and you query the root directory of the drive, the function returns .T.. The workaround is:
* lcfile is the file to check for in the root
lcpath = SET('PATH')
SET PATH TO
? FILE()
SET PATH TO (lcpath)
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform