Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Check if a file exists
Message
From
04/05/2004 09:33:41
 
 
To
04/05/2004 08:52:53
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00900659
Message ID:
00900681
Views:
13
>Hello,
>I my VFP app, I want to check to see if a file exists, and if not I want a way to detect that. Any suggestions?
>
>MAC


Mike,

a couple of possiblitites
*--------------------------------------------------------------------------
Function	FileExists(FileName)
    && declare Integer GetFileAttributes in win32api string @

	return (GetFileAttributes(@m.FileName) <> -1)
endfunc
*--------------------------------------------------------------------------
also possible
*--------------------------------------------------------------------------
Function	FileExists(FileName)

 	return  (alen(adir(aa, FileName, 'DHS')) > 0)
endfunc
*--------------------------------------------------------------------------
I would avoid file() since it searches the set('path') if it can not find it and may return wrong information.
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform