Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
File count
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Versions des environnements
Visual FoxPro:
VFP 6
OS:
Windows XP
Divers
Thread ID:
01247999
Message ID:
01248004
Vues:
20
>HI All,
> I need to know how can I get the total number of folders in a given path.
>
>Fox example:
>
>file path is G:\MRP\Parts\
>
>
>In Parts folder I have three folders such as GM folde, Buick folder and Nissan folder. In each of the folder I may have a file with .hsp extension. I need to dele all the file with the .hsp extension. My brain is not working well right now and I can not seems to figure this out.
>
>Any help willl be great!!
>
>Thanks
>
>MA

You would need to do it recursively ever with Scripting.FileSystemObject or with ADIR()

That's something I wrote recently from the top of my head, you would need to adapt it.
LOCAL loFSO, loFolder  
  CREATE CURSOR curDirs (cpath C(254))  
  loFSO = CREATEOBJECT('Scripting.FileSystemObject')  
  loFolder = loFSO.GetFolder(GETDIR())   
  =GetFolders(m.loFolder)  
  BROWSE  
    
  FUNCTION GetFolders  
  LPARAMETERS toFolder  
  LOCAL loItem  
  IF m.toFolder.SubFolders.COUNT = 0  
  	INSERT INTO curDirs VALUES (m.toFolder.PATH)  
  ELSE  
  	FOR EACH loItem IN m.toFolder.SubFolders  
  		IF m.loItem.SubFolders.COUNT = 0  
  			INSERT INTO curDirs VALUES (m.loItem.PATH)  
  		ELSE  
  			=GetFolders(m.loItem)  
  		ENDIF  
  	NEXT  
  ENDIF
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform