To implement and test a C program using system calls for files and directories.
Description
Find is a popular UNIX command that traverses a file hierarchy and performs various functions on each file in the hierarchy. The goal of this project is to implement a program similar to find that supports the following functionality:
The program should take the directory name from where to start the file traversal as a command-line argument and print the file hierarchy starting with the directory that is provided by the command-line
If the program is executed without any arguments, the program should print the file hierarchy starting with the current directory where the program is executed. If there are no directories in the current directory only files are listed one per
If there are other directories in the current directory then the directory name is first displayed on a separate line and then the files in that directory are listed one-per-line with one-tab indentation.
If a file is a symbolic link then the program should display the symbolic link name and in parentheses the file name the link points
The program should also support two command-line options:
-s
This should list all files in the file hierarchy with file size greater than or equal to the value specified.
-f
This should list all files in the file hierarchy whose file name or directory name contains the substring specified in the string pattern option.
If both -s and -f options are specified then the program should list only those files that match both criteria. The order of the options should not
Guidelines and Hints
The program must use function pointers similar to Figure 4.22 in the text book to implement the functionality described above. You can use the logic and structure from Figure 4.22 as the starting point to implement this program (make sure to go over the program in Figure 4.22 and understand all the steps performed). However, please note that your final program must compile and execute without any dependencies on the source code provided by the text
You should use a Makefile to compile and build this project and make sure to submit the Makefile along with the rest of the source
You should create a tar file with all the source code, Makefile, and a README file and upload the tar file to Canvas. Please do not include any object files or executable files in the tar
Program Documentation and Testing
Use appropriate names for variables and
Include meaningful comments to indicate various operations performed by the program.
Programs must include the following header information within comments
Test your program with the sample test cases provided as well as your own test cases.
You can include any comments you may have about testing in the README
Examples
Command |
Description |
$ ./find |
List all files in the current directory where the program is executed. |
$ ./find ../programs |
List all files in the directory ../programs (relative to the current directory) |
$./find /home/UAB/puri/CS332/programs |
List all files in the directory /home/UAB/puri/CS332/programs (absolute path) |
$./find -s 1024 |
List all files with size >= 1024 bytes in the current directory |
$./find -s 1024 ../programs |
List all files with size >= 1024 bytes in the ../programs (relative to the current directory) |
$./find -f jpg |
List all files that have the substring “jpg” in their filename or directory name in the current directory |
$./find -f jpg -s 1024 |
List all files that have the substring “jpg” in their filename or directory name with size >= 1024 in the current directory |
$./find -s 1024 -f jpg |
List all files with size >= 1024 and have the substring “jpg” in their filename or directory name in the current directory |
Sample Input and Output:
If you have the following directory structure as shown by the output of "ls -lR" command
Then the output of find without any argument should look like this
It is not necessary that the order of the files are exactly as shown above, but the overall structure should look similar to the output shown above. You can use the following tar file to create the directory structure: projects.tar. Download this file and extract the file using the command
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme