Example One - Part 1 - Archiving files
Creating an archive
After the initial prepration you can create your initial archive:
# make backup rm -f *.o cut out tags wcp wcpd wcp-1.0.12.tar.gz wcp store $HOME/zz-backup/wcp -v 0001 0001 # . S ./backup-etc S ./check-copy S ./config.c S ./config.h S ./io-lib.c S ./io-lib.h S ./lib.c S ./lib.h S ./makefile S ./server.c S ./server.h S ./stat.c S ./stat.h S ./test-handler.sh S ./version.c S ./wcp.1 S ./wcp.c S ./wcp.h S ./wcpd.1 # ./zz-test S ./zz-test/README S ./zz-test/empty.txt
The first two lines in the output refer to the commands make is executing to do the "backup" target. wcp's output starts with the "
0001 0001" line.
Let's take a short look at the wcp command line first. The interesting command (you could also run from the command line) is
# wcp store $HOME/zz-backup/wcp -v
store parameter tells wcpto store the files from the local directory. This is followed by the destination, in this case the local directory "
Finally the command line option "
-v" switches to wcp's verbose mode. wcp will list in this mode the files it is storing in the server space.
- The first command line parameter is always the wcp operation.
- Options may be added after the server argument
The output from above tells the following:
The first word in the first output line gives the archive's version number, the second word the full name under which this version is stored. In this examples both values are identical. These two values are printed always, not only in verbose mode.
Each directory output is preceded by a line starting with a pound sign followed by the directory name. All but the first directory listing is preceded with an empty line.
lines starting with a "
S" is printed for files that are stored in the archive.
So to summarize the output from above: the archive's version number is "0001" and all files are stored on the server.
Let's look at the server space.
# ls $HOME/zz-backup/wcp/ 0001/
There is one directory, named with the archive's version number. Listing the directory's content will show you exact copies of the files in the wcp source directory.
Time for a first and simple test.
# make backup rm -f *.o cut out tags wcp wcpd wcp-1.0.12.tar.gz wcp store $HOME/zz-backup/wcp -v 0002 0002 # . # ./zz-test
Since nothing was changed since the last run, nothing had to be copied. Only files that have been modified are copied to the server space.
# ls /home/wzk/zz-backup/wcp 0001/ 0002/
And in the server space you have two directories, one for each version. If you like you can play around with the wcp directory, either with the source files or the zz-test directory which is only made for testing.
By default archives are simply numbered with 4 digits, beginning with "0001". If you want you can add labels to the version numbers with the
# make clean rm -f *.o cut out tags wcp wcpd wcp-1.0.12.tar.gz # touch makefile # wcp store $HOME/zz-backup/wcp -v -n test 0003 0003-test # . S ./makefile # ./zz-test
The full name of archive version 3 is 0003-test (see wcp's output) and this name is also used as directory name.
# ls $HOME/zz-backup/wcp 0001/ 0002/ 0003-test/
In the example above the makefile was stored beacuse it's timestamp was modified with the touch command. This is one criteria to find modified files.
Some other store options are
- -m maxsize[unit]
Files that are larger that maxsize bytes are ignored. maxsize may be followed by one of the characters k or M to set the value in kilo or megabytes.
- -o pattern
- sets an extended regular expression for filenames to exclude.
Now that you have seen how wcp works, read how archives are organised.