logo Use SA10RAM to get 10%* Discount.
Order Now logo

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

expert
Bill BaileyLaw
(5/5)

501 Answers

Hire Me
expert
Shanza AkbarSocial sciences
(/5)

602 Answers

Hire Me
expert
Santosh DevgodaMathematics
(5/5)

893 Answers

Hire Me
expert
Sarandeep GuptaGeneral article writing
(5/5)

599 Answers

Hire Me
C Programming

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

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. 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

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

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

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

262 Experts Online