Tar Archiving Using Relative Paths

If you want to archive a directory (using the tar command), but not include the absolute path to the directory. You can use the -C option to the tar command, which essentially cd’s into the directory and then archives it. Here is an example:

$ tar czf /tmp/my_backup.tar.gz -C ~/home/coorp/my_files

When un-archived, the directory structure will be:

And not:

Fin.