Tar dereference only 1 level

Posted by Bart van Heukelom on Server Fault See other posts from Server Fault or by Bart van Heukelom
Published on 2012-08-28T08:33:10Z Indexed on 2012/08/28 9:40 UTC
Read the original article Hit count: 256

Filed under:
|
|

I use the following pseudo-script to create a TAR of my installed software

mkdir tmp
ln -s /path/to/app1/bin              tmp/app1
ln -s /and/path/going/to/the-app-2   tmp/app2
tar -c --dereference -f apps.tar tmp

I need the --dereference option here to follow the links I just made in tmp. The reason I make the links in the first place is to store the directories with a different name in the archive than they have on the filesystem.

Until now it has worked fine. However, I now have the situation that /path/to/app1 also contains links, and those I don't want to follow.

Is this possible with some changes to the tar command? Or do I need to completely switch around the way I build the archive?

© Server Fault or respective owner

Related posts about linux

Related posts about tar