>>Nadya,
>>
>>Go ahead and FAQ it is you want. There's some discussion of it over on the Wiki too. There's no doubt that a
few calls to a builtin function is going to be
significantly faster than thousands of calls to a COM object.
>>
>Found two interesting links in WiKi:
>
http://fox.wikis.com/wc.dll?Wiki~WindowsScriptingHost~WIN_COM_DNA>
http://fox.wikis.com/wc.dll?Wiki~RecursionInVFP~VFP>
And then for copying things recursively where you don't care about pulling things back, just copying all the .DBF, .FPT and .CDX files to a backup directory:
DECLARE INTEGER SHFileOperation IN SHELL32.DLL STRING @ LPSHFILEOPSTRUCT
DECLARE INTEGER GetActiveWindow IN WIN32API
SET PROCEDURE TO CLSHEAP ADDITIVE
oHeap = CREATEOBJ('Heap')
#DEFINE FO_COPY 2
#DEFINE FOF_NOCONFIRMATION 0x10
#DEFINE FOF_NOCONFIRMMKDIR 0x200
cSourceString = 'C:\MyOldDir\*.DBF' + CHR(0) + ;
'C:\MyOldDir\*.FPT' + CHR(0) + ;
'C:\MyOldDir\*.CDX' + CHR(0) + CHR(0)
cDestString = 'D:\MyNewDir' + CHR(0) + CHR(0)
nStringBase = oHeap.AllocBlob(cSourceString+cDestString)
cFileOpStruct = NumToDWORD(GetActiveWindow()) + ;
NumToDWORD(FO_COPY) + ;
NumToDWORD(nStringBase) + ;
NumToDWORD(nStringBase + LEN(cSourceString)) + ;
NumToDWORD(FOF_NOCONFIRMMKDIR + FOF_NOCONFIRMATION) + ;
CHR(0) + ;
NumToDWORD(0) + ;
NumToDWORD(0)
IF SHFileOperation(cFileOpStruct) = 0
ELSE
ENDIF
oHeap = ''
>I decided not to repeat this discussion.
>
>
>>>I've just ran tests on my local Windows 95 machine c drive:
>>>Results: 19866 files in 4 sec by adir and in 78 sec. by FSO. (time periods are the same in bunch of tests).
>>>Also I looked in MSDN online help on Scripting.FileSystemObject and I didn't find a way to specify file sceleton, like "*.scx" (we can do it in adir())
>>>
>>>I modified a little these programs (I'm going to implement it for searching specific string in specific Form's method Thread #
430305)
>>>
>>>BTW, I think both approaches should be placed in FAQ section here, because they are very important. What do you think?