Question: In this assignment you will create a program capable of archiving the contents of a directory into a single file, much like tar does. You

In this assignment you will create a program capable of archiving the contents of a directory into a single file, much like tar does. You will write a makefile that compiles your program into an executable named arch, which has usage

arch

action

-c to create a new archive file

-e to expand an existing archive file

source

Specifies the path-name of a directory that contains the files to be archived (-c) or of the archive file (-e) being expanded.

target

Specifies the path-name of the archive file that is to be created (-e) or of the directory to be created to hold the contents of the archive file.

Based on the command line arguments does one of the following:

Create: Create a new archive file (target) that, for each file in the directory specified by source, contains the data required to restore the file's name and data. The source directory is unchanged.

Expand: Create a new directory (target), which will contain all of the files and directories in the archive file, in their directory structure

Recurse the entire sub-tree rooted by (source) on create or expand

Proper care (error reporting / program termination) when opening and creating files and directories is required.

Sample Runs:

% ./arch -c . my_archive 
archiving .  
Done  my_archive as been created 

% ./arch -e ./expand_test my_archive 
expanding to ./expand_test  
Done  my_archive as been expanded 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!