Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WSH and Subfolders of Subfolders
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00224547
Message ID:
00224757
Vues:
19
>Hi Patric,
>
>In order to accomplish this, you'll need to create a recursive routine. The following is an example UDF that will list all files for a given starting path, then call itself with any folders within that path:
>
*
>* listfiles.prg
>*
>
>lparameters cFolder
>
>if right(cFolder,1) # '\'
>	cFolder = cFolder + '\'
>endif
>
>? cFolder
>
>oFSO = CreateObject("scripting.FileSystemObject")
>
>if oFSO.FolderExists(cFolder)
>
>	oFolder = oFSO.GetFolder(cFolder)
>
>	for each oFile in oFolder.Files
>		? cFolder + oFile.Name
>	endfor
>
>	for each oSubFolder in oFolder.SubFolders
>		? cFolder + oSubFolder.Name
>		listfiles(cFolder + oSubFolder.Name)
>	endfor
>
>else
>
>	=messagebox("Path " + cFolder + " does not exist")
>
>endif
>


Thanks for the help, Ken. My brain always wants to start spinning when dealing with recursion... In some silly way I was hoping there was a magical switch or parameter I could use to avoid it! :-)

Thanks again,
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform