Question: ( 5 0 % ) Part I: Write a program that reads a given directory ( on the command line ) and searches for files
Part I: Write a program that reads a given directory on the command line and searches for files
that match using some or all of the following:
If a user enters name, use the next argument after name as the name of the file or
directory you search for
If a user enters R the search should be recursive not otherwise
If a user enters uid, use the next argument after uid as the UID to search for only select
files owned by the given uid
if a user enters type, use the next argument after type as the type of file to search for
only include files of that given typefor instance regular files, directories, block files, etc.
Part II: Write a program that recursively prints out all the full paths of all directories and files in
a given directory that uses forks the children to do the recursive methods.
Each process should print out their directory and all regular files in their directory
All children and parents should contain a program that runs upon its exit, indicating that it
is dying indicate directory
If a directory has a subdirectory, fork a child to recurse into the subdirectory. Note that
means the parent stays in the current directory and the child does the subdirectory call.
Maintain a counter and make sure not to leave any zombies around... each parent should
wait for its children before exiting.
Extra credit
Part I: Create a mechanism for the search to use the size of the file: I want to see It gt and eq you
can use all three at the same time
Part II: Consider the performance of Part II Create a version that doesn't fork and compare the
time it takes to run both... you should run each program several times to ensure accurate results. The
major answer you want to ask,time. "Does adding the fork make for better performance?"
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
