Advertisement
jsbsan

recursividad

Jul 4th, 2014
1,581
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data Copied
Advertisement