Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 is: xxx.

The total number of files in directory is: yyy.

The total number of bytes occupied by all files in directory is: zzz.

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions