Generally a folder is compressed by

tar -czvf archivename.tgz /path/to/folder/

The problem is that when archivename.tgz is untarred the folder structure would be

path > to > folder

For the archivename.tgz  to have just the folder and all of its contents, use the -C (change directory) option

tar -C /path/to -czvf archivename.tgz folder/

Leave a Reply