I am trying to tar a directory without the parent directories and I have found a solution so far which removes the parent directories and tar all the files under a directory called (DIR) to a DIR.tar.gz file using the following:
tar -cvzf $DIR.tar.gz -C $path/$DIR .
But if I want to untar the tared file, it will untar all the files in the current directory, however, I want to be able to tar the dir in a way which when I use tar -xzvf, it will untar it into folder called DIR. IT should be simple, but I am not able to find the solution on the net. Any hint?