Question
Create a C++ program that can be used in a unx file system 1. A files counter (named filecnt) program filecnt accepts one argument which
Create a C++ program that can be used in a unx file system
1. A files counter (named filecnt) program
filecnt accepts one argument which is the path of a directory in a Unix file system.
The minimum requirement is that filecnt can accept and process an absolute path, but if your program can accept and process other forms of paths (e.g. relative path, '~' expansion, etc...) extra credit points will be given. If you implement these extra features they must be clearly documented to receive extra credit points.
The program then recursively explores (traverses) the given directory and counts 1) the total number of directories, 2) the total number of plain files (i.e. not directory), and 3) the total number of bytes occupied by those plain files. If an entry in a directory is not accessible (no permission to access), or an entry is a link to another location of the file system, the program should skip (i.e. do not count) that entry.
After processing the given directory, the program should output the following text to the standard output:
The total number of directories in directory
The total number of files in directory
The total number of bytes occupied by all files in directory
Obviously xxx, yyy, and zzz must be replaced by actual data after processing.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started