Removing Extra Folders From a TAR

I use an extremely simple TAR function for files at work and I have a question about cleaning them up.

My command is TAR -cvf ExampleTarName.tar then the folder I wish to TAR.

When my TAR finishes and I double click it to check it unarchived beautifully (I don't do this with every file, duh) a long folder bath exists before I get to the actual Folder and Files that I want in the TAR. Example:

User/myname/Desktop/To Upload/GraphicName/AfterEffectsFiles

The bolded section ALL I'd like to see TARed in my finished product. How do I make that happen?

Possibly really simple to fix! Thank you in advance!

Use the -C option to tell tar to change directory before archiving.

tar -C User/myname/Desktop/To Upload/ -vcf filename.tar GraphicName/AfterEffectsFiles

Awesome, Corona, trying now!

Am I using the right order? Should it be -vcf or -cvf?

---------- Post updated at 02:17 PM ---------- Previous update was at 02:07 PM ----------

Doesn't work.Still get a bunch of extra folders in my finished TAR. And -vcf made the Terminal explode.

I swear I read about a fix about this forever ago, any other idea out there besides change directories?

The order doesn't matter. Play scrabble if you want. You can also explode them into -v -c -f.

Tell me exactly what you typed, word for word, letter for letter, keystroke for keystroke. I don't think -vcf had anything to do with it, you might have accidentally dumped data into the terminal.

I'll have to make some text folders since I'm working with corporate sensitive things. I'll respond with screenshots on Monday, when I have more time! Thanks for you help, Corona :slight_smile:

I tried what I posted before I did so, and it did work. Change the filenames of course, but "doesn't work" doesn't tell me what you actually did.

I'll make an example for you.

$ mkdir -p a/b/c/d
$ touch a/b/c/d/e
$ tar -C a/b -vcf filename.tar c/d
c/d/
c/d/e

$ tar -C a/b -vcf filename.tar c/d # See, it's the same
c/d/
c/d/e

$ tar -tf filename.tar # As requested, leading folders a/b are stripped off in the tarball
c/d/
c/d/e

$