Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q2 Directory Space Usage.attaching the PDF 2 Directory Space Usage [35 Marks] In this question, you have to write a program (myDU. c) that finds
Q2 Directory Space Usage.attaching the PDF
2 Directory Space Usage [35 Marks] In this question, you have to write a program (myDU. c) that finds the space used by a directory (including its files, sub-directories, files in sub-directories, sub-sub directories etc.). Let's call this directory as the Root directory. Syntax $./myDU Example Documents (4096 bytes) Bill Payment.pdf (2324 bytes) Experiment_Results.txt Office (4096 bytes) (178 bytes) Deals.ppt (9590 bytes) $./myDU Documents 20284 Note: 4096 + 2324 + 178 + 4096 +9590 = 20284 bytes Figure 1: Example to illustrate the use of directory space usage finding utility Figure 1 shows the structure of a directory called Documents which is the designated Root directory in this example. This directory contains files such as Bill Payment.pdf, Experiment Results.txt and a sub-directory called Office. The Sub-directory Office contains a file named Deals.ppt. To find the size of the Documents directory, its name is passed to your directory space usage finding utility as ($./myDU Documents). Your utility is expected to print the total size of the contents of the passed root directory in bytes (For eg: 20284). Note that, this is inclusive of directory sizes.
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