![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
![]() |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
#1
|
|||
|
|||
|
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.
|
|
#3
|
|||
|
|||
|
Men, yo no se nada de delphi, por eso te escribo en esteapartado. yo programo en c++ y necesito en codigo en este.
|
|
#5
|
|||
|
|||
|
Man, ¿no existe una busqueda de ficheros que sea mas rapida?, esta es super lenta
|
|
#6
|
||||
|
||||
|
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. |
|
#7
|
|||
|
|||
|
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......................
|
|
#8
|
|||
|
|||
|
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.
|
|
#9
|
|||
|
|||
|
hermanos necesito su ayuda en este tema. Gracias por su colaboracion
|
|
#10
|
|||
|
|||
|
hola,¿me escuchan?, uno, dos, tres, probando, gracias, gracias. Gracias por su atrencion.... hermanos ayudenme con este tema please.
|
|
#11
|
||||
|
||||
|
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;
}
|
|
#12
|
|||
|
|||
|
gracias hermano, disculpa si te he causado alguna molestia.
|
![]() |
|
|
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 |
|