Upload files to "/"
This commit is contained in:
30
clist.c
Normal file
30
clist.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
|
||||
int main() {
|
||||
DIR *dir = opendir(".");
|
||||
struct dirent *de;
|
||||
|
||||
if (!dir) {
|
||||
perror("opendir");
|
||||
return 1;
|
||||
}
|
||||
|
||||
while ((de = readdir(dir)) != NULL) {
|
||||
if (strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0)
|
||||
continue;
|
||||
|
||||
if (de->d_type == DT_DIR) {
|
||||
printf("\033[34m%s\033[0m ", de->d_name);
|
||||
} else if (de->d_type == DT_REG) {
|
||||
printf("%s ", de->d_name);
|
||||
} else {
|
||||
printf("%s ", de->d_name);
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
closedir(dir);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user