accounting for files "." and ".."
This commit is contained in:
@ -38,6 +38,10 @@ unsigned long get_dir_size(char *path){
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
if (file_modifiers & FILE_MODIFIERS_HIDDEN_FILES) {
|
||||
/* removes files "." and ".." */
|
||||
entry_count -= 2;
|
||||
}
|
||||
return entry_count;
|
||||
|
||||
}
|
||||
@ -45,7 +49,7 @@ unsigned long get_dir_size(char *path){
|
||||
void get_dir_content(char *path, unsigned long *dir_file_count, file *dir_content){
|
||||
struct dirent **entry;
|
||||
if (file_modifiers & FILE_MODIFIERS_HIDDEN_FILES) { /* print hidden files */
|
||||
scandir(path, &entry, NULL, alphasort);
|
||||
scandir(path, &entry, skip_dot, alphasort);
|
||||
} else {
|
||||
scandir(path, &entry, skip_hidden_files, alphasort);
|
||||
}
|
||||
|
Reference in New Issue
Block a user