This asignment is due on Friday, 18th September
Introduction
In order to make sure that files are not lost through disk
corruption, it is common practice to back them up. The
typical method of just copying all files from one directory
to another is slow, wasteful of space, and may not handle
subdirectories. This assignment is to write a smarter backup
than this.
Requirements
The backup program should take two command line parameters
which are the names of two directories: the source directory
and the destination directory. The program should scan the
source directory recursively, and backup any files that have
not previously been backed up, or which have changed since
last backup, into the
corresponding location in the destination directory.
When a file is backed up, it is first copied to the destination
directory (or a suitable subdirectory), and then compressed
using the program gzip
. This reduces its size,
and renames it by adding the extension .gz
.
If a file is modified, then its modification date will be
more recent than the backup file with a .gz
extension.
Errors
All errors should be handled appropriately. For example, if
the source directory does not exist, the program should
exit with an error message. If a file cannot be backed
up because it is, say, unreadable, then a message should be
printed and the program should carry on.
Language and O/S
You can write the assignment in either C or C++ or a mixture.
The program will need to be able to find the sets
of files in directories
so will need to use Operating System specific calls.
You should use at least
the Unix system calls so that it will run under Unix.
If you want, you can also have Win32 calls,
and compile each separately
using conditional compilation.