File Type Statistics Using C

# Introduction This chapter is based on the file and directory interfaces of Linux. This project revolves around the nature of the file system, using the `lstat` function and directory operations to implement a program for recursively counting file types. It provides a convenient way to gain a deep understanding of the composition of file types in the Linux file system. Additionally, the file type counting program developed in this project can be used in practical learning and work environments. ## 👀 Preview ```bash $ ./file_type . regular files = 2, 66.67 % directories = 1, 33.33 % block special = 0, 0.00 % char special = 0, 0.00 % FIFOs = 0, 0.00 % symbolic links = 0, 0.00 % sockets = 0, 0.00 % ``` ## 🎯 Tasks In this project, you will learn: - How to implement a program in C that recursively counts file types in a directory using Linux file and directory interfaces. ## 🏆 Achievements After completing this project, you will be able to: - Use the `lstat` function to obtain file information in Linux. - Perform directory operations such as opening directories and reading directory entries. - Create a program that recursively counts different file types, including regular files, directories, block special files, character special files, named pipes, symbolic links, and sockets. - Calculate and display the percentage of each file type within a directory.

|60 : 00

Click the virtual machine below to start practicing