Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to work with files in system/hidden folders
Message
 
 
À
08/01/2000 14:34:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00314887
Message ID:
00314991
Vues:
56
Ed,

Thanks for posting the WSH version. My tests conclude it is 8 to 9 times slower than the equivalent ADIR() based code. Here's the full disk traverse ADIR version:
ltStart = datetime()

create cursor tempfiles ( cFilename c(80), nSize n(10), dMod d )

RecurseFolder( "c:\" )
? datetime() - ltStart

index on nSize tag nSize

browse nowait

function RecurseFolder( lcDir )
local i,n, laFiles[1]

?? "."
n = adir( laFiles, lcDir + "*.*", "shd" )

for i = 1 to n
   if ( left( laFiles[i,1], 1 ) != '.' )
      if ( "D" $ laFiles[i,5] )
         RecurseFolder( lcDir + laFiles[i,1] + "\" )
      else
        insert into tempfiles ;
               values( lcDir + laFiles[i,1], laFiles[i,2], laFiles[i,3] )
      endif
   endif
endfor
return
Both versions return 57607 rows in the cursor, so I don't see any problems with ADIR() but this is a Win98 box, it might be different under NT.

>Dave, ADIR() will read them, but there are anomalies in ADIR()'s behavior with some legal LFNs, and I've had problems copying files into System/Hidden folders. Scripting.FileSystemObject doesn't have these problems, and offers lots of additional functionality as well, like access to the file attributes, copy and move operations for folders or files, and lots of useful details like short names, short paths, and all three file dates if the underlying file system supports them!
>
>The following is a similar function using the Scripting.FileSystemObject, :
>
>
create cursor tempfiles ( cFilename c(200), nSize I, dMod d, FolderAttr I, FileAttr I )
>oFSO = CreateObject('Scripting.FileSystemObject')
>oFolder = oFSO.GetFolder('c:\')
>=RecurseFolder(oFolder, 'tempfiles')
>INDEX ON nSize TAG nSize
>BROWSE
>
>FUNCTION RecurseFolder
>LPARAMETER toFolderObject, tcAliasName
>FOR EACH oFile IN toFolderObject.Files
>   INSERT INTO (tcAliasName) VALUES (oFile.Path, oFile.Size, oFile.DateLastModified, toFolderObject.Attributes, oFile.Attributes)
>ENDFOR
>FOR EACH oSubFolder in toFOlderObject.SubFolders
>   RecurseFolder(oSubFolder,tcAliasName)
>ENDFOR
>toFolderObject = NULL
>RETURN
>
>
>
>>>Anybody know any tricks to get Fox to see files stored in system/hidden directories with file related commands (i.e. FILE(), GETFILE(), COPY FILE)? I am working on a little utility that parses an html file which is being stored by I.E. in a system folder 'temp internet files\content.ie5'. None of the VFP commands will see the file because the directory is marked as system directory and I can't seem to change it. I can copy the file out to another directory using Explorer and then work with it in VFP, but I'd like to be able to do this in code.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform