[kwlug-disc] tar --directory help please
Ronald Barnes
ron at ronaldbarnes.ca
Wed Jun 4 13:33:42 EDT 2025
I've always found the --directory option for `tar` to be so frustrating
as to be worse than useless.
Can someone explain this behaviour?
There are 2 files I want to include:
# ll /etc/systemd/system/mailman*
-rw-r--r-- 1 mailman root 461 2025-05-31 07:00
/etc/systemd/system/mailman3.service
-rw-r--r-- 1 mailman root 1226 2025-06-04 06:35
/etc/systemd/system/mailman3-web.service
However... errors with or without quotes around the path to archive:
# tar -vcf ffs.tar --directory=/ etc/systemd/system/mailm*
tar: etc/systemd/system/mailm*: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
If I exclude the wildcard:
# tar -vcf ffs.tar --directory=/ etc/systemd/system/
etc/systemd/system/
etc/systemd/system/network-online.target.wants/
etc/systemd/system/network-online.target.wants/networking.service
etc/systemd/system/mailman3.service
...
And the last file shown is one of the target files.
What is going on?!?
This has driven me absolutely bonkers for years and I'm determined to
figure it out.
ChatGPT struggles with it, and I can't even blame it.
More information about the kwlug-disc
mailing list