1

I was looking for an answer, I thought I found it, but it doesn't work correctly :-S

Question: I want to pack: /foo/bar/dir/* but when I unpack the tar I would like to have /dir/*

So i thought:
1) tar -cvf file.tar /foo/bar/dir -C /dir
or
2) tar -cvf file.tar /foo/bar/dir -C /foo/bar

But when I open the TARs they both have the first dir: foo, then bar etc...

  • This is off-topic here. – Hauke Laging Feb 24 '13 at 17:37
  • @HaukeLaging: Why would this not be related to system administration ? – Iain Feb 24 '13 at 17:43
  • @lain I didn't mean that tar is not related to system administration. I meant that this is a page for server professionals. Ever seen a *nix admin who doesn't know how to use tar? I have experienced more "difficult" questions which I have answered being moved to another site. By my impression of the behaviour here this is a legitimate question but on unix or superuser. – Hauke Laging Feb 24 '13 at 17:50
1

It is the order of the options:

tar -cvf file.tar -C /foo/bar dir
0

$ cd /foo/bar
$ tar -cvf /other/dir/path/file.tar dir

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.