Using tar, the entire folder structure is including, I don't want that

Posted by Blankman on Ask Ubuntu See other posts from Ask Ubuntu or by Blankman
Published on 2012-04-12T22:04:00Z Indexed on 2012/04/12 23:45 UTC
Read the original article Hit count: 396

Filed under:
|

I am taring a folder and for some reason the entire directory structure that preceds the folder I am tarring is included.

I am doing this in a script like:

'tar czf ' + dir + '/asdf.tgz ' + dir + 'asdf/'

Where dir is like:

/Downloads/archive/

In the man pages, I see I can fix this but I can't get it to work.

I tried:

tar czf -C dir ...

But now I have some kind of a file -C in my folder (which I can't seem to delete btw!).

Please help!

© Ask Ubuntu or respective owner

Related posts about tar

Related posts about compression