Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
If a file exists
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00996204
Message ID:
00996213
Views:
16
>Does anybody know how I can check programmatically if a file exists in a certain location. I have a path and file stored to a variable and i want to check if it exists. For example:
>
>C:\program files\pictures\dress.tif
>
>If this file exists in this location I want to issue a messagebox command.
>
>Any help would be greatly appreciated.


Neil, Keep in mind that If You use a FILE() function You can be confused if the file You search is placed in folder stored in SET PATH TO..., but You want to check the existing of a file in some different folder.
make a folder named TEST in C:
Place dress.tif here, and use a FILE() with path that You are shure Dress.TIF not exists.
and do:
*** In MyDir there is no file dress.tif
SET PATH TO c:\test
? FILE("C:\MyDir\dress.tif")  && .T. ????????????????
a workaround:
** If You want to use FILE() function
m.old_path = SET("PATH")
SET PATH TO
? FILE("C:\MyDir\dress.tif")  && .F. 
SET PATH TO (m.old_path)
**** End with FILE() function

*** Other way is to use SYS(2000) function

? .NOT. EMPTY(SYS(2000, "C:\MyDir\dress.tif")) && .F.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform