(tar)Creating an Archive of a Subdirectory bis
Next:
Compare bis Prev:
How to Archive Directories Up:
How to Create Archives
Creating an Archive from the Superior Directory
-----------------------------------------------
*(This message will disappear, once this node revised.)*
You can archive a directory by specifying its directory name as a
file name argument to `tar'. The files in the directory will be
archived relative to the working directory, and the directory will be
re-created along with its contents when the archive is extracted.
To archive a directory, first move to its superior directory. If you
have been following the tutorial, you should type:
% cd ..
%
Once in the superior directory, you can specify the subdirectory as a
file name argument. To store the directory `practice' in the archive
file `music', type:
% tar --create --verbose --file=music practice
`tar' should output:
practice/
practice/blues
practice/folk
practice/jazz
practice/records
Note that the archive thus created is not in the subdirectory
`practice', but rather in the working directory--the directory from
which `tar' was invoked. Before trying to archive a directory from its
superior directory, you should make sure you have write access to the
superior directory itself, not only the directory you are trying
archive with `tar'. Trying to store your home directory in an archive
by invoking `tar' from the root directory will probably not work.
FIXME: xref absolute-names
(Note also that `records', the original archive file, has itself
been archived. `tar' will accept any file as a file to be archived,
regardless of its content. When `music' is extracted, the archive file
`records' will be re-written into the file system).
You can store a directory in an archive by using the directory name
as a file name argument to `tar'. When you specify a directory file,
`tar' archives the directory file and all the files it contains. The
names of the directory and the files it contains are stored in the
archive relative to the current working directory-when the directory is
extracted they will be written into the file system relative to the
working directory at that time.
FIXME: add an xref to --absolute-names
To archive a directory, first move to its superior directory. If you
have been following the tutorial, you should type:
% cd ..
%
Once in the superior directory, specify the subdirectory using a
file name argument. To store the directory file `~/practice' in the
archive file `music', type:
% tar --create --verbose --file=music practice
`tar' should respond:
practice/
practice/blues
practice/folk
practice/jazz
practice/records
Note that `~/practice/records', another archive file, has itself
been archived. `tar' will accept any file as a file to be archived,
even an archive file.
FIXME: symbolic links and changing directories are now in main body,
FIXME: not in tutorial.
automatically generated by info2www version 1.2