Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Recursion using FSO
Message
De
17/05/2001 10:22:25
Robert Herrmann
Tx Dept. of Health - Cancer Registry
Austin, Texas, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00508249
Message ID:
00508292
Vues:
29
>>>>when doing a recursive dir listing using the scripting.filesystemobject method. In the insert command I am using the following:
>>>>
>>>>INSERT INTO filesFSO (Path, Filename, Size, Created, Modified);
>>>>VALUES (.Path, .Name, .Size, .DateCreated, .DateLastModified)
>>>>
>>>>at which point i get a OLE error code 0x800a0005: Unknown COM status code msg box.
>>>>
>>>>BUT, when I leave the .DateCreated out, it runs just fine. Takes forever but it runs :)
>>>>
>>>>Any ideas what is causing this error to creep up with the .DateCreated?
>>>>
>>>>TIA!
>>>
>>>Robert,
>>>
>>>The following works fine for me
lcfile = GETFILE("*")
>>>IF NOT EMPTY(lcfile)
>>>  oFSO = CREATEOBJECT("Scripting.FileSystemObject")
>>>  CREATE CURSOR filesFSO (Path M, FileName M, Size I, Created T, Modified T)
>>>  oFile = oFSO.GetFile(lcfile)
>>>  WITH oFile
>>>    INSERT INTO filesFSO (Path, Filename, Size, Created, Modified);
>>>    VALUES (.Path, .Name, .Size, .DateCreated, .DateLastModified)
>>>  ENDWITH
>>>ENDIF
>>
>>
>>Hmmm.. I'm missing something here then.. Here's part of what I'm using...
>>
FUNCTION RecurseFolderFSO
>>LPARAMETER toFolderObject
>>WITH toFolderObject
>>   FOR EACH oFile IN .Files
>>      WITH oFile
>>         INSERT INTO filesFSO (Path, Filename, Size, Created, Modified);
>>             VALUES (.Path, .Name, .Size, .DateCreated, .DateLastModified)
>>      ENDWITH
>>   ENDFOR
>>   FOR EACH oSubFolder in .SubFolders
>>      RecurseFolderFSO(oSubFolder)
>>   ENDFOR
>>ENDWITH
>>
Robert,
>
>You're not missing anything. Not all folders expose all the date/time properties. I was able to duplicate what's happening to you with the following:
lcdir = GETDIR() && Selected the Windows\System folder
>oDir = oFSO.GetFolder(lcdir)
>? oDir.DateCreated && COM error 0x800a0005
The workaround is that
? TYPE('oDir.DateCreated')
returns "U". If it's "T", then you can access the property.

Ouch.. that must've been it.. I just ran it on a slave drive that had no system files in it and it didn't give the error...

hmm.. maybe an if.. endif.. statement then where if the type is u it won't try for the .datecreated and if it's t then it will....

OR.. I can just tell the network manager tough doodoo. he'll have to settle with just datelastmodified :) but I guess a few extra lines of code won't hurt anything.. :)

Thanks for the catch.. I was getting ready to pull my hair out for awhile there :) hehe
Robert Herrmann
Texas Cancer Registry
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform