1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| Path=inputbox("Entrez le chemin du repertoire a Analyser","Analyse JLW")
MsgBox ShowFolderList(Path),,"Liste des fichiers du répertoire """ & Path
Function ShowFolderList(strPath)
Dim fso, Dossiers, fic, fichiers, strListe, f, r
Dim Valeur, imax, z, Cible, liste
Set fso = CreateObject("Scripting.FileSystemObject")
Set Dossiers = fso.GetFolder(Path)
Set fic = Dossiers.Files
imax = 0
For Each fichiers In fic
Set f = fso.GetFile(fichiers)
imax = imax + 1
ReDim Preserve Tableau(2, imax)
Tableau(1, imax) = f.Name
Tableau(2, imax) = f.Type
Valeur = 0
For imax = 1 To imax - 1
For z = 1 To 2
Cible = Tableau(z, imax)
Tableau(z, imax) = Tableau(z, imax + 1)
Tableau(z, imax + 1) = Cible
Next
Valeur = 1
Next
Next
For r = 1 To imax
liste = liste & vbCrLf & r & " " & Tableau(1, r) & " " & Tableau(2, r)
Next
liste = vbCrLf& "N° Nom du fichier Type" &vbCrLf& liste
ShowFolderList = liste
Set Ftxt = FSO.createTextFile("\\repertoire\liste.txt",true)
Ftxt.writeline (liste)
Ftxt.Close
End Function |
Partager