When I try to compress files and directories with tar
using absolute paths, the absolute path is preserved in the resulting compressed file. I need to use absolute paths to tell tar
where the folder I wish to compress is located, but I only want it to compress that folder – not the whole path.
For example, tar -cvzf test.tar.gz /home/path/test
– where I want to compress the folder test
. However, what I actually end up compressing is /home/path/test
. Is there anything that can be done to avoid this? I have tried playing with the -C operand to no avail.