J
Joris De Groote
Hi,
I have a program that must look in in certain folder and take out every file
(also the files in subfolders). Now it's no problem to do this with a few
for's and if's. However, I don't know how many subfolders there will be, it
can be 1, it can be 3, but it could be 15 to. I don't want to write all
these if's and for's in each other and than still be limited with the
predefined number of folders that are coded in the for/if structure. So can
someone help me out here without having me to write that very long
structure?
Thanks
Joris
----example of code how I can write it----
'Inlezen aantal Sitemappen
dir1 = System.IO.Directory.GetDirectories(bronmap)
Dim i As Integer
If dir1.GetLength(0) > 0 Then
'Mappen gevonden in ZipBronMap
For i = 0 To (dir1.GetLength(0) - 1)
'Mappen in dir1
'Inlezen mappen
dir2 = System.IO.Directory.GetDirectories(dir1(i) + "\")
If dir2.GetLength(0) > 0 Then
.......... (more code here but can't copy all, it's like always the same...)
End If
Next
'Geen mappen gevonden in ZipBronMap (dir1 leeg)
'Kijken naar PDF Bestanden & Verwerken
files = System.IO.Directory.GetFiles(bronmap)
If files.GetLength(0) > 0 Then
Bestand_Controle(files)
End If
Else
'Geen mappen gevonden in ZipBronMap (dir1 leeg)
'Kijken naar PDF Bestanden & Verwerken
files = System.IO.Directory.GetFiles(bronmap)
If files.GetLength(0) > 0 Then
Bestand_Controle(files)
End If
End If
I have a program that must look in in certain folder and take out every file
(also the files in subfolders). Now it's no problem to do this with a few
for's and if's. However, I don't know how many subfolders there will be, it
can be 1, it can be 3, but it could be 15 to. I don't want to write all
these if's and for's in each other and than still be limited with the
predefined number of folders that are coded in the for/if structure. So can
someone help me out here without having me to write that very long
structure?
Thanks
Joris
----example of code how I can write it----
'Inlezen aantal Sitemappen
dir1 = System.IO.Directory.GetDirectories(bronmap)
Dim i As Integer
If dir1.GetLength(0) > 0 Then
'Mappen gevonden in ZipBronMap
For i = 0 To (dir1.GetLength(0) - 1)
'Mappen in dir1
'Inlezen mappen
dir2 = System.IO.Directory.GetDirectories(dir1(i) + "\")
If dir2.GetLength(0) > 0 Then
.......... (more code here but can't copy all, it's like always the same...)
End If
Next
'Geen mappen gevonden in ZipBronMap (dir1 leeg)
'Kijken naar PDF Bestanden & Verwerken
files = System.IO.Directory.GetFiles(bronmap)
If files.GetLength(0) > 0 Then
Bestand_Controle(files)
End If
Else
'Geen mappen gevonden in ZipBronMap (dir1 leeg)
'Kijken naar PDF Bestanden & Verwerken
files = System.IO.Directory.GetFiles(bronmap)
If files.GetLength(0) > 0 Then
Bestand_Controle(files)
End If
End If