Article 5RAR0 [SOLVED] Is this possible? Create a tar.gz of a directory and place it in a different directory without all of the directories nested in the path?

[SOLVED] Is this possible? Create a tar.gz of a directory and place it in a different directory without all of the directories nested in the path?

by
wh33t
from LinuxQuestions.org on (#5RAR0)
Lemme explain. I wanna back up webroot located at /var/www/html/webroot by creating a file called webroot.tar.gz but I wanna place it in /var/www/html/archive, in the archive itself I only want to see the webroot directory, and it's files contained with in. I do not want to open the archive and see var, then www, then html, then webroot. I have a feeling I need to be using the -C option but I can't for the life of me figure out how.

Any tips? I am hoping to do this in a single command.

Update: I figured it out! Thanks for reading anyhow.

Code:tar -czf /var/www/html/archive/webroot.tar.gz -C /var/www/html/ webrootlatest?d=yIl2AUoC8zA latest?i=tub5cQmasUg:W_3zf0hT7Xg:F7zBnMy latest?i=tub5cQmasUg:W_3zf0hT7Xg:V_sGLiP latest?d=qj6IDK7rITs latest?i=tub5cQmasUg:W_3zf0hT7Xg:gIN9vFwtub5cQmasUg
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments