On Thu, Aug 07, 2025 at 13:37:36 -0500, Richard Owlett wrote: > /ABC/qrz/help is a directory *ONLY* on another person's machine. > I had downloaded XYZ.tar.xz from a repository. > I wish to decompress it to obtain a local copy of only the files in > /ABC/qrz/help for my local machine.
Once again, we need to see how the files are archived. If the tarball was created by GNU tar, then a leading slash is NOT permitted in the archive member names (at least by default), and you'll receive a warning message if you try to create a tarball with such files in it: hobbit:~$ tar cvf /tmp/foo.tar /etc/group tar: Removing leading `/' from member names /etc/group The resulting tarball will have the leading slash stripped out: hobbit:~$ tar tvf /tmp/foo.tar -rw-r--r-- root/root 934 2024-03-24 11:18 etc/group You see there, the archive member name is "etc/group" and not "/etc/group". Since there is no leading slash in the member name, when you extract the file(s) from the archive, the directory structure will be created relative to wherever you ask the extraction to take place. If there's an "etc" subdirectory already, then the file "group" will be placed in it. If there's no "etc" subdirectory yet, one will be created. Normally the extraction point will be the current working directory, wherever you type the command. If you use the "-C" option, you can specify a different starting point. So, back to your obviously obfuscated example: you claim that your archive contains a directory named "/ABC/qrz/help" with a leading slash. I doubt this is true. It's more likely "ABC/qrz/help", unless the archive was created on a commercial Unix system, or the person creating the archive was a fool or a troll. So, next let's assume you're in your home directory, and this directory is named "/home/richard". Extracting the archive files you want would therefore create a "/home/richard/ABC/qrz/help" directory, unless you already have one, and it would put some files inside there. If you want the files to be somewhere else, cd there first, or use the "-C" option.

