#include <stdio.h>
#include <dirent.h>
#include <string.h>
void getAllFilesAndDirs(char *mainpath) {
char path[1024];
struct dirent *drnt;
DIR *dir = opendir(mainpath);
if (!dir)
return;
while ((drnt = readdir(dir)) != NULL) {
if (strcmp(drnt->d_name, ".") != 0 && strcmp(drnt->d_name, "..") != 0) {
printf("%s\n", drnt->d_name);
strcpy(path, mainpath);
strcat(path, "/");
strcat(path, drnt->d_name);
getAllFilesAndDirs(path);
}
}
closedir(dir);
}
int main(int argc, char **argv)
{
getAllFilesAndDirs("c:\\xampp\\htdocs\\allonpage.com");
return 0;
}
/*
run:
db.php
functions.php
connect.php
email.php
footer.php
header.php
index.php
bootstrap.min.css
jquery.min.js
...
*/