logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

To implement and test a C program using system calls for files and directories find the popular UNIX command that traverses a file hierarchy

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

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:

 

  1. 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

  2. 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

  3. 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.

  4. 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

  5. The program should also support two command-line options:

    1. -s

This should list all files in the file hierarchy with file size greater than or equal to the value specified.

  1. -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.

  1. 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

  1. 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

  2. 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

  3. 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

 

  1. Use appropriate names for variables and

  2. Include meaningful comments to indicate various operations performed by the program.

  3. Programs must include the following header information within comments

  4. Test your program with the sample test cases provided as well as your own test cases.

  5. 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

 

Looking for affordable and reliable assignment help? Look no further! Our assignment help service offers top-notch assistance at the lowest prices you can find. We understand the importance of academic success and are committed to helping you achieve it without breaking the bank. Trust us to provide you with exceptional support every step of the way.

c programming assignment help

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

594 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

919 Answers

Hire Me
expert
Husnain SaeedComputer science

800 Answers

Hire Me
expert
Atharva PatilComputer science

627 Answers

Hire Me