I’m currently trying to write a script to back up some files by taking the relevant files and compressing them into a tarball. The problem is, I need to remove two layers of folders in the middle of their structure so that they can be directly extracted into the necessary directory. For example, my current structure looks like this:
foo/bar/remove/remove/files...
but needs to look like this when extracted:
foo/bar/files...
Because of how many files I’m backing up, copying the needed files up two levels before tar-ing isn’t really an option. I’ve looked into using --directory, but that doesn’t seem to do what I’m looking for.
Is there a way to do this, or am I out of luck?
Wound up creating a replica of the directory structure with a symbolic link to the needed folder, then used the
-hoption ontarto follow it.