PUBLIC SUB copia_dir(path_origen AS String, path_destino AS String, OPTIONAL tipo as String)
DIM arDir AS string[]
DIM arFile AS string[]
DIM nombredir, nombrefile AS String
IF NOT tipo then tipo="*"
IF NOT Exist(path_destino) THEN
MKDIR path_destino
ENDIF
arfile = Dir(path_origen, tipo, gb.file) 'extraemos los ficheros
FOR EACH nombrefile IN arfile 'los copiamos
COPY path_origen &/ nombrefile TO path_destino &/ nombrefile
NEXT
ardir = Dir(path_origen, "*", gb.Directory)
FOR EACH nombredir IN arDir 'extraemos los subdirectorios
copia_dir(path_origen &/ nombredir, path_destino &/ nombredir) 'usamos la recursividad
NEXT
END
DIM arDir AS string[]
DIM arFile AS string[]
DIM nombredir, nombrefile AS String
IF NOT tipo then tipo="*"
IF NOT Exist(path_destino) THEN
MKDIR path_destino
ENDIF
arfile = Dir(path_origen, tipo, gb.file) 'extraemos los ficheros
FOR EACH nombrefile IN arfile 'los copiamos
COPY path_origen &/ nombrefile TO path_destino &/ nombrefile
NEXT
ardir = Dir(path_origen, "*", gb.Directory)
FOR EACH nombredir IN arDir 'extraemos los subdirectorios
copia_dir(path_origen &/ nombredir, path_destino &/ nombredir) 'usamos la recursividad
NEXT
END
Espero que os sea útil.
Suerte