Download Solution: Click to Download Solution
Solution File Name: CSCCPE3350Lab4Part1RecursiveFileSearch.docx
Unzip Password: prestobear.com
There are three requirements for this assignment that contribute to your final grade: the program itself,
comments and style, and GitHub commits.
1. (30 points) The Recursive File Search Program
Note: parameters in  are optional, parameters in <> are required. The | (pipe) means “or.”
• file_search (25 points)
o Usage: file_search
o Example: file_search .c /home/user/mystuff
Searches all file and directory names in /home/user/mystuff directory for
occurrences of .c
you should ensure the provided path starts with a /, but does not end with a /
file_search “hello there” /home/user/mystuff
bash, and other shells, understand the “ “ and pass the text as one argument.
o DO NOT OPEN ANY FILES WITH OPEN OR FOPEN, IF YOU ACCIDENTALLY RECURSIVELY
OPEN ALL FILES IN A DIRECTORY FOR WRITING, YOU MAY DESTROY ALL FILES IN YOUR
HOME DIRECTORY; YOU HAVE BEEN WARNED.
o Your program should print all files and directories whose names contain the search
term. Your program should also print the time it took to do the search. Append a “:” to
directories so they are visually distinguishable from files. Example output for the
command above might be:
/home/user/mystuff/.c: a directory!
o The elapsed time you print should be from the first call to your recursive function until
right after it completes.