flatmax
Messages postés37Date d'inscriptionjeudi 9 mai 2002StatutMembreDernière intervention30 août 2003
-
16 sept. 2002 à 18:43
cs_Benzoid
Messages postés9Date d'inscriptionvendredi 13 septembre 2002StatutMembreDernière intervention26 septembre 2002
-
17 sept. 2002 à 08:36
j'ai recupéré une source afin de lister tt les repertoires d'un lecteur ds un txt, mais le prob est que je voudrais juste lister le chemin du dernier sous-dossiers
par ex si il y a ce dossier :
c:\dossier\sous-dossier1\sous-dossier2\
ds le txt apparait
ce que je voudrais c'est juste lister :
c:\dossier\sous-dossier1\sous-dossier2\
est-ce que qqn peut m'aider ?
voila le code que j'ai recupéré sur vbfrance...
##################
Option Explicit
Dim Variable, OldVariable
Private Sub Form_Load()
Open "Albums.txt" For Output As #1
Dir1.Path = "c:"
Do Until Dir1.ListIndex = Dir1.ListCount - 1
Dir1.ListIndex = Dir1.ListIndex + 1
Print #1, Dir1.List(Dir1.ListIndex)
Call FunctionRecursive
Loop
Close #1
End
End Sub
Function FunctionRecursive()
MemTempDir.AddItem Dir1.ListIndex
Dir1.Path = Dir1.List(Dir1.ListIndex)
Do Until Dir1.ListIndex = Dir1.ListCount - 1
Dir1.ListIndex = Dir1.ListIndex + 1
Print #1, Dir1.List(Dir1.ListIndex)
Call FunctionRecursive
Loop
Dir1.Path = Dir1.List(-2)
Dir1.ListIndex = MemTempDir.List(MemTempDir.ListCount - 1)
MemTempDir.RemoveItem (MemTempDir.ListCount - 1)
End Function
##################
cs_Benzoid
Messages postés9Date d'inscriptionvendredi 13 septembre 2002StatutMembreDernière intervention26 septembre 2002 17 sept. 2002 à 08:36
Salut
Tu peux rajouter ce code
Private Sub Form_Load()
Dim char1,char2
Open "Albums.txt" For Output As #1
Dir1.Path = "c:"
Do Until Dir1.ListIndex = Dir1.ListCount - 1
Dir1.ListIndex = Dir1.ListIndex + 1
Print #1, Dir1.List(Dir1.ListIndex)
Call FunctionRecursive
Loop
Close #1
Open "albums.txt" For Input As 1
Open "resultats.txt" For Output As 2
Input #1, char1
While Not EOF(1)
Input #1, char2
If InStr(char2, char1) = 0 Then
Print #2, char1
End If
char1 = char2
Wend
Close #1
Close #2
End
End Sub