Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Faster FILE and DIRECTORY commands...
Message
 
 
To
04/12/2001 10:52:23
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00589304
Message ID:
00589316
Views:
32
You could test using DRIVETYPE(lcDrive) first which is very fast even if there is no mapping to that drive. The other 2 functions work extremely fast for me using either a drive map or UNC, with or without the file/folder being there. I see no performance hit going against Novell or NT servers as well. I am using VFP 7. In all cases the return values were false. Sample code that I ran:
#DEFINE NT_SERVER_PATH '\\R6ntbak1\users\mmccasla\Archives\'
#DEFINE NW_SERVER_PATH '\\R6Watlan\Vol2\Users\mmccasla\'
SET TALK OFF
CLEAR
?
lnNWStart = SECONDS()
FOR lnI = 1 TO 1000
	lcFolder = JUSTFNAME(SYS(3))
	lcFile   = FORCEEXT(SYS(3), 'TXT')
	llRetVal = FILE(NW_SERVER_PATH + lcFile)
	llRetVal = DIRECTORY(NW_SERVER_PATH + lcFolder)
ENDFOR
lnNWEnd = SECONDS()
? 'NW:', lnNWEnd - lnNWStart && returned 15.254 seconds
lnNTStart = SECONDS()
FOR lnI = 1 TO 1000
	lcFolder = JUSTFNAME(SYS(3))
	lcFile   = FORCEEXT(SYS(3), 'TXT')
	llRetVal = FILE(NT_SERVER_PATH + lcFile)
	llRetVal = DIRECTORY(NT_SERVER_PATH + lcFolder)
ENDFOR
lnNTEnd = SECONDS()
? 'NT:', lnNTEnd - lnNTStart  && returned 12.592 seconds
?
RETURN
>Hi!
>
>I as wondering if anyone has an alternative to the FILE
>and DIRECTORY commands maybe an API call is better??? The problem is in our applications we have a lot of external sketches on various servers
>and it can be quite slow to run the FILE or DIRECTORY commands on server
>drives... (Especially if the file is missing or something...)
>
>For example if i run the command:
>
> DIRECTORY('T:\myfolder') and T: is not connected because e are offline
> it takes a long time to return .F.!
> also
> FILE('\\myserver\myshare\myfile.cnv') seems to take a long time when the file
>is not there..
>
>Thanks
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform