Go to the previous, next section.

Absolute File Names

(This message will disappear, once this node revised.)

When tar extracts archive members from an archive, it strips any leading slashes (`/') from the member name. This causes absolute member names in the archive to be treated as relative file names. This allows you to have such members extracted wherever you want, instead of being restricted to extracting the member in the exact directory named in the archive. For example, if the archive member has the name `/etc/passwd', tar will extract it as if the name were really `etc/passwd'.

Other tar programs do not do this. As a result, if you create an archive whose member names start with a slash, they will be difficult for other people with an inferior tar program to use. Therefore, GNU tar also strips leading slashes from member names when putting members into the archive. For example, if you ask tar to add the file `/bin/ls' to an archive, it will do so, but the member name will be `bin/ls'.

If you use the `--absolute-names' (`-P') option, tar will do neither of these transformations.

FIXME: is this what this does, or does it just preserve the slash?  

To archive or extract files relative to the root directory, specify the `--absolute-names' (`-P') option.

Normally, tar acts on files relative to the working directory--ignoring superior directory names when archiving, and ignoring leading slashes when extracting.

When you specify `--absolute-names' (`-P'), tar stores file names including all superior directory names, and preserves leading slashes. If you only invoked tar from the root directory you would never need the `--absolute-names' (`-P') option, but using this option may be more convenient than switching to root.

FIXME: should be an example in the tutorial/wizardry section using this
FIXME: to transfer files between systems.

FIXME: is write access an issue?

`--absolute-names'
Preserves full file names (inclusing superior dirctory names) when archiving files. Preserves leading slash when extracting files.

Go to the previous, next section.