Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Api for ADIR
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00156185
Message ID:
00156546
Vues:
45
>>>Actually, I'm working on something like this for Advisor right now. However, I think Mark could modify my class fairly easily to do the job he needs done.
>>>
>>>Mark, if you want to try that and need some help, give me a shout.
>>
>>Hi George,
>>
>>To perform a similar function that Mark was wanting to do (Return a listing of folders only), I am using something like oFile = CREATEOBJECT("Filer.Fileutil") and passing the parameter to start in root, return all files (*.*) and include subdirectories. Later I can retrieve just the path of each file returned through oFiles.Path, which in essence gives me every folder on the drive. I work my way through the oFile.Files[x] and insert each oFile.Path and oFile.Name into an existing table, filtering out any unwanted files according to file extension or date modified.
>>
>>I had questions when I began to code this as to what potential problems I might be opening myself up to, but so far it has worked fine. (At an engineering office, one of the reasons we did this was to check the entire network, about 65 users, and retrieve the just the CAD drawings that had changed that day and backup just those files to a network drive. Some of the users are 95, NT, and SGI using NFS for a connection)
>>
>>Of course the above is a simplified example of the code, as I had to use the API to connect to each user and then check their folders and files, then disconnect. But given Mark's original question, would you see this as a solution for him?
>>
>>I would be interested in knowing:
>>---------------------------------
>>1) If this method would do what Mark needs by simply retrieving the oFiles.Path
>>2) You see any hidden uh-oh's or gotchas that I've overlooked
>>3) There are any distribution issues (VFP was loaded on the client's PC in my situation)
>>
>>Any input is appreciated,
>
>Patric,
>
>I'd be inclined to use the Shell.Application automation object to build the list; Shell.Application provides a mechanism to return FolderItem objects, which can then be recursed as needed. As a starting point, try something like:
>
>
>oShell = CREATEOBJ('Shell.Application')
>*  Grab a FolderItem object using Namespace;  you can either reference a starting folder by name
>*  or use on of the special folder constants;  I'll use ssFDrives (0x11, or 17) to make a list of drives
>oFolderItem = oShell.NameSpace(0x011)
>*  Now grab a Folderitems collection
>oItems = oFolderItem.Items
>FOR EACH item IN oItems
>   ? item.path
>   *  each item here is a FolderItems collection;  you can retrieve it's child Folder Object with the
>   *  GetFolder method, and then recurse that structure.
>   IF item.IsFolder
>      oFolderObj = item.GetFolder
>      oChildren = oFodlerObj.Items
>   ENDIF
>ENDFOR
>
Hi Ed,

Nice stuff. Since there's been a number of posts (by you and Erik Moore, I think) regarding the Shell Application object, it'd be nice to know the source of the information. I'm sure that there are other folks, besides myself, around here who would be interested as well.

Regards,
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform