Créer l'arborescence complète d'un path
Créer si nécessaire tous les répertoires d'un emplacement tel que le fait la commande mkdir
Function MakeDir (strPath)
Dim strParentPath, objFSOMkDir
Set objFSOMkDir = CreateObject("Scripting.FileSystemObject")
strParentPath = objFSOMkDir.GetParentFolderName(strPath)
Wscript.echo "Parent folder path : " & strParentPath
If Not objFSOMkDir.FolderExists(strParentPath) Then MakeDir strParentPath 'Si le répertoire parent n'existe pas, on fait un appel récursif de la fonction
If Not objFSOMkDir.FolderExists(strPath) Then objFSOMkDir.CreateFolder strPath 'Si on est arrivé à cette ligne, c'est que le répertoire parent existe. Si le répertoire à créer n'existe pas, on le cré
MakeDir = objFSOMkDir.FolderExists(strPath)
Set objFSOMkDir = Nothing
End Function
Lien vers le fichier : cliquez ici
Publicité
Pages Web
| Site Web | Description |
|---|---|
| Windowsitpro.com | Article où j'ai récupéré le code |
Article(s) précédent(s)