Advertisement
jsbsan

recursividad

Jul 4th, 2014
3,786
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GAMBAS 0.69 KB | None | 0 0
  1. Public Sub ListaArchivos(directorioinicial As String)
  2.   Dim file As String
  3.   Dim directoryName As String
  4.   Dim arrayDirectorio As New String[]
  5.    
  6.   For Each directoryName In Dir(directorioinicial, "*", gb.Directory)
  7.     'añado al array el subdirectorio encontrado
  8.     arrayDirectorio.add(directoryName)
  9.   Next
  10.  
  11.   For Each directoryName In arrayDirectorio
  12.     For Each file In Dir(directorioinicial & "/" & directoryName)
  13.       Print "Directorio: ", directorioinicial & "/" & directoryName, "archivo: ", file
  14.     Next
  15.     'ahora busco en el subdirectorio si hay más archivos...  ¡¡ recursivamente !!
  16.     ListaArchivos(directorioinicial & "/" & directoryName)
  17.   Next
  18.  
  19.   Return
  20.  
  21. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement