def copydir(self, path):
"""
Copy the contents of the local directory given by path to google cloud.
Maintain the same directory structure on remote.
This is (intentionally) a blocking call, so clients can report errors if
the transfer fails.
:type path: string
:param path: relative or absolute path to the directory that needs to be copied
:return: True when transfer is complete
:raises OSError: path doesn't exist or permission denied
:raises ValueError: if the library cannot determine the file size
:raises gcloud.exceptions.GCloudError: if upload status gives error response
"""
if not os.access(path, os.R_OK):
raise OSError('Permission denied')
for filename in find_files(path):
blob = Blob(filename, self)
blob.upload_from_filename(filename)
return True
评论列表
文章目录