Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > C++ Builder
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 20-08-2010
kenychy kenychy is offline
Miembro
 
Registrado: ago 2010
Posts: 45
Poder: 0
kenychy Va por buen camino
como buscar ficheros recursivamente

Hello friends, necesito saber como buscar ficheros recursivamente, sin importar que sea una carpeta del sistema, o que este oculta, vacía, o que los ficheros estén ocultos y que funcione para unidades raíz.
Responder Con Cita
  #2  
Antiguo 20-08-2010
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Poder: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola kenychy.

El tema se trató Aca . Incluye código Delphi, pero se puede traducir sin mucho cambio.

Saludos.

Última edición por ecfisa fecha: 20-08-2010 a las 18:11:50.
Responder Con Cita
  #3  
Antiguo 20-08-2010
kenychy kenychy is offline
Miembro
 
Registrado: ago 2010
Posts: 45
Poder: 0
kenychy Va por buen camino
Men, yo no se nada de delphi, por eso te escribo en esteapartado. yo programo en c++ y necesito en codigo en este.
Responder Con Cita
  #4  
Antiguo 20-08-2010
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.197
Poder: 20
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
Quizás esto te interese.

Saludos.
Responder Con Cita
  #5  
Antiguo 31-08-2010
kenychy kenychy is offline
Miembro
 
Registrado: ago 2010
Posts: 45
Poder: 0
kenychy Va por buen camino
Man, ¿no existe una busqueda de ficheros que sea mas rapida?, esta es super lenta
Responder Con Cita
  #6  
Antiguo 31-08-2010
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.197
Poder: 20
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
Depende del tamaño del disco... Explorar todo el disco es penoso. Incorpora un Application->ProcessMessages() en el bucle para que no aparente un "cuelgue". También puedes colocar la función en un hilo a parte del principal.

Si sólo quieres buscar ficheros y no listarlos todos, modifica el código para no llenar el StringList con todos los ficheros sino con los que te interesen, ganarás algo en velocidad.


Saludos.
Responder Con Cita
  #7  
Antiguo 31-08-2010
kenychy kenychy is offline
Miembro
 
Registrado: ago 2010
Posts: 45
Poder: 0
kenychy Va por buen camino
tio, eso ya lo puse en un Thread, pero sigue siendo igual de lento, si has usado el supercopier te daras cuenta de que busca los ficheros a la velocidad de la luz; lo que nesecito es algo como esto. Si me pudieras decir si hay una API, que lo haga de otra forma mas rapida te lo agradeceria mucho......................
Responder Con Cita
  #8  
Antiguo 13-09-2010
kenychy kenychy is offline
Miembro
 
Registrado: ago 2010
Posts: 45
Poder: 0
kenychy Va por buen camino
Como puedo usar la busqueda del explorador de windows!!

Tios, necesiso saber como puedo usar la busqueda del explorador de windows, si esta es una funcion o una dl, y como puedo trabajar conella para buscar archivos en un directorio, las agradeceria mucho su alluda.
Responder Con Cita
  #9  
Antiguo 20-10-2010
kenychy kenychy is offline
Miembro
 
Registrado: ago 2010
Posts: 45
Poder: 0
kenychy Va por buen camino
hermanos necesito su ayuda en este tema. Gracias por su colaboracion
Responder Con Cita
  #10  
Antiguo 19-11-2010
kenychy kenychy is offline
Miembro
 
Registrado: ago 2010
Posts: 45
Poder: 0
kenychy Va por buen camino
hola,¿me escuchan?, uno, dos, tres, probando, gracias, gracias. Gracias por su atrencion.... hermanos ayudenme con este tema please.
Responder Con Cita
  #11  
Antiguo 20-11-2010
Avatar de javier_ecf
javier_ecf javier_ecf is offline
Miembro
 
Registrado: sep 2010
Posts: 32
Poder: 0
javier_ecf Va por buen camino
Bueno apesar de lo algo molesto que fue leer tus post (Recomiendo que leas la Guia de estilo),
Encontre cierto codigo que busca recursivamente archivos y carpetas en c++.

Código:
// The next two lines are for VC++ 6.0 compiler.  You should 
// delete them if you compile it with a different compiler.
#include "stdafx.h"
#pragma warning(disable: 4786)
#include <io.h>
#include <string>
#include <vector>
#include <list>
#include <iostream>
using namespace std;


// structure to hold a directory and all its filenames.
struct FILELIST
{
    string path;
    vector<string> theList;
};


void TransverseDirectory(string path, list<FILELIST>& theList)
{
    struct _finddatai64_t data;
    // First create the filename that will be use to initialize the find.
    // "*.*" are wild card characters that tells the find function to return a 
    // list of all the files and directories.  You can limit this if you wish
    // to just file with specific extensions, for example "*.txt".  If you do that
    // then finder will not return any directory names.
    string fname = path + "\\*.*";
    // start the finder -- on error _findfirsti64() will return -1, otherwise if no
    // error it returns a handle greater than -1.
    long h = _findfirsti64(fname.c_str(),&data);
    if(h >= 0)
    {
        FILELIST thisList;
        // add empty FILELIST structure to the linked list argument
        theList.push_back(thisList);
        // get pointer to the FILELIST just added to the linked list above.
        list<FILELIST>::iterator it = theList.end();
        it--;
        // set current path
        (*it).path = path;
        do {
            if( (data.attrib & _A_SUBDIR) )
            {
                // make sure we skip "." and "..".  Have to use strcmp here because
                // some file names can start with a dot, so just testing for the 
                // first dot is not suffient.
                if( strcmp(data.name,".") != 0 &&strcmp(data.name,"..") != 0)
                {
                    // We found a sub-directory, so get the files in it too
                    fname = path + "\\" + data.name;
                    // recursion here!
                    TransverseDirectory(fname,theList);
                }

            }
            else
            {
                // this is just a normal filename.  So just add it to our vector
                (*it).theList.push_back(data.name);

            }
        }while( _findnexti64(h,&data) == 0);
        // close the find handle.  
        _findclose(h);

    }

}

int main(int argc, char* argv[])
{
    list<FILELIST> MyList;
    string path;
    cout << "Enter starting path ... ";
    getline(cin,path);
    TransverseDirectory(path,MyList);
    list<FILELIST>::iterator it;
    // now just display all the files
    for(it = MyList.begin(); it != MyList.end(); it++)
    {
        vector<string>::iterator its;
        for(its = (*it).theList.begin(); its != (*it).theList.end(); its++)
        {
            cout << (*it).path + "\\" + (*its) << endl;
        }

    }
    cin.ignore();
    return 0;
}
Responder Con Cita
  #12  
Antiguo 14-12-2010
kenychy kenychy is offline
Miembro
 
Registrado: ago 2010
Posts: 45
Poder: 0
kenychy Va por buen camino
gracias hermano, disculpa si te he causado alguna molestia.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
como descargar ficheros de internet jfadelphi Varios 3 04-03-2009 09:14:59
como relalizar una busqueda de ficheros con las api bastardo10 API de Windows 1 18-06-2007 13:27:50
Rellenar treeview con un directorio recursivamente mierda Varios 2 13-04-2007 19:09:49
como abrir ficheros con Word Quin C++ Builder 12 25-08-2006 09:13:54
como accedo a ficheros aleatorios giovanni Tablas planas 2 26-09-2004 23:56:12


La franja horaria es GMT +2. Ahora son las 06:22:54.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi