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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started