[kwlug-disc] tar --directory help please

Ronald Barnes ron at ronaldbarnes.ca
Thu Jun 5 13:02:23 EDT 2025


William Park via kwlug-disc wrote on 2025-06-05 08:47:

> I was going to suggest this, but okay.  Then, your only choice is
> use subshell (cd / && tar ...) or pushd/popd which is the same thing.

I could avoid those "mildly annoying" warnings about "Removing leading 
`/' from member names" via this option to `tar`:

`tar --warning=no-file-removed ...`

I've done that before too.


Thanks everyone, some good ideas!


> 
> On 2025-06-04 15:36, Ronald Barnes via kwlug-disc wrote:
>>> All that said, it looks like in your example, you're trying to 
>>> preserve the full path (hence --directory=/).  You don't need to use 
>>> --directory for that. Just provide the full path to the files, that 
>>> will be preserved in the zip.
>>>
>>>      $ tar -cf /tmp/test.tar /etc/systemd/system/mailm*
>>
>> This causes the mildly annoying warning:
>>
>> tar: Removing leading `/' from member names
>>


More information about the kwlug-disc mailing list