If you want to create a tarball to backup all of your files to another directory, try this:
tar -cvzpf /newdirectory/newfile.tgz /olddirectory
Then you would expand/restore it like this: tar -C /restoredirectory -xvzpf /newdirectory/newfile.tgz
Or simply tar -xvzpf newfile.tgz to just expand it in place.
The c switch is "create"
The x is "extract"
The z is "gzip" (if supported - depends on distro)
The p is "permissions" (it keeps all your permissions the intact, rather than using umask)
The f is "file"
http://en.wikipedia.org/wiki/Tar_%28file_format%29
This won't help you with the python aspect necessarily
