Uploading tar files to dropbox
I'm trying to upload tar files to the dropbox using this:
get_client().put_file(path_for_tar_in_db, see_below ,True)
I tried so far:
see_below = open(path,'r') see_below = path see_below = tarfile.open(path,'r')
Nothing helped so far.
First one makes corrupted files.
Second creates txt files.
And last one just errors.
Can somebody please help me? :)
Sadly it isn't working. Still getting a ReadError :-/
get_client().put_file(path_for_tar_in_db, see_below, True)
but perhaps it should be:
get_client().put_file(path_for_tar_in_db, see_below, overwrite=True)
This self-archiving code works for me:
Running this puts a copy of the current script at the root of a new local .tar file and then pushes that .tar file up to Dropbox. After I run this I can open a terminal on my Mac and:
tar -tvf ~/Dropbox/my_archive.tar
-rw-r--r-- 0 501 501 5276 Jun 6 15:09
tar -xvf ~/Dropbox/my_archive.tar
[ ... ]
Could it be that you didn't close the tar file after writing to it? That might explain the corrupted file.
Thank you ccc I changed the upload to the way you wrote it and the upload seems to work fine now.
Still getting ReadError when downloading the files like this:
The file appears within the folder still not able to untar.
Here is the other half of the puzzle. It does roughly the opposite of the script above. It reads the tar file from Dropbox and writes a local copy. It then does a tar extractall on that local copy to recreate the original script (!! It will overwrite !!)
Thank you all!
cccs solution works fine :)