Question: Expert in C language a program that opens a directory, parses each directory entry, display file size and name, and recursively open subdirectories. With no

Expert in C language

a program that opens a directory, parses each directory entry, display file size and name, and recursively open subdirectories. With no argument provided, your program will open the current working directory. If an argument is provided, your program will open the directory specified. In order to create this program, you need to use the following programming APIs:

-DIR *opendir(const char *name);

-struct dirent *readdir(DIR *dirp);

-int lstat(const char *path, struct stat *buf);

Your program will keep a total of bytes used by each file and display that total at the end of your program run.

OUTPUT SHOULD LOOK SOMETHING LIKE THIS :

$ ./assn8 dir . 17371:assn8 170:Makefile 1715:assn8.c 11416:assn8.o Total file space used:30672

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!