I am trying to create a graphical program for my script.
Inside the script I use tar to create a tar archive.
From the graphical program I get the full name of file that I want to create a tar archive.
tar -cvf temp.tar /home/username/dir1/dir2/selecteddir
My tar archive includes home, username, dir1, dir2 and selecteddir while i want tar to create archive only including selecteddir.
Best Answer
You can use the
-C
option oftar
to accomplish this:From the man page of
tar
: