#include <stdio.h>
#include <dirent.h>
#include <string.h>
void listaDir(char nome[])
{ DIR *folder;
struct dirent *entry;
char aux[50];
gets(aux);
folder = opendir(nome);
if(folder == NULL)
{
//perror("Unable to read directory");
return;
}
while( (entry=readdir(folder)) )
{
if(strcmp(entry->d_name, ".")!=0 && strcmp(entry->d_name, "..")!=0) //chamo recursivamente
{
printf("%s/%s\n", nome, entry->d_name);
char nomeAux[50];
strcpy(nomeAux, nome);
strcat(nomeAux, "/");
strcat(nomeAux, entry->d_name);
listaDir(nomeAux);
}
}
closedir(folder);
}
int main()
{ char aux[50];
gets(aux);
listaDir("..");
return(0);
}