Minireto listar directorios & archivos

Iniciado por _katze_, Febrero 25, 2011, 09:05:20 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Febrero 25, 2011, 09:05:20 PM Ultima modificación: Mayo 27, 2014, 09:46:06 PM por Expermicid
esta es una forma de obtener los archivos y directorios que le pasamos como parametro aver quien me propone una mejor y mas rapida.
en un listbox y pasando como parametro "C:\windows\system32" me carga en 99 milisegundos je
Código: csharp
Function ListDir(ByVal StrPath As String) As ArrayList
        Dim dir As DirectoryInfo = New DirectoryInfo(StrPath)
        Dim ta As ArrayList = New ArrayList()
        For Each subdir As DirectoryInfo In dir.GetDirectories
            ta.Add(subdir.FullName)
        Next
        For Each Filef As IO.FileInfo In dir.GetFiles
            ta.Add(Filef.Name)
        Next
        Return ta
    End Function


Código: C#
Private void ListaDir(String folder)
{
try
{
String[] dirs = System.IO..Directory.GetDirectories(folder);

foreach (String dir in dirs)
{
ListaDir(dir);
}
}
catch { }
}


Para listar los directorios se me ocurrio esto :P ando medio malito ... hoy para pensar mas
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login


Llaman traidor a la persona que evito que caiga el foro, gente bruta!



pues si te devuelve una string te devolvera todo junto luego trendras que parsear  :-\

 :'( TIenes razon no me di cuenta.. de ese punto jejeej me pongo a  trabajar llegando a mi casa

Saludos :P
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login


Llaman traidor a la persona que evito que caiga el foro, gente bruta!



System.Collections.ArrayList al = new System.Collections.ArrayList();
al.AddRange(System.IO.Directory.GetDirectories(sPath));
al.AddRange(System.IO.Directory.GetFiles(sPath));
return al;

Podria agregarse una recursiva.
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login