def _upload_folder(cf, folder, container, ttl=None, headers=None):
 total_bytes = 0
 for (root, dirs, files) in os.walk(folder):
  for fname in files:
   full_path = os.path.join(root, fname)
   obj_name = os.path.relpath(full_path, folder)
   obj_size = os.path.getsize(full_path)
   cf.upload_file(container, full_path, obj_name=obj_name, return_none=True, ttl=ttl, headers=headers)
   total_bytes += obj_size
 return total_bytes

def _upload_folder ( cf , folder , container , ttl = None , headers = None ) : total_bytes = 0 for ( root , dirs , files ) in os . walk ( folder ) : for fname in files : full_path = os . path . join ( root , fname ) obj_name = os . path . relpath ( full_path , folder ) obj_size = os . path . getsize ( full_path ) cf . upload_file ( container , full_path , obj_name = obj_name , return_none = True , ttl = ttl , headers = headers ) total_bytes += obj_size return total_bytes
uploads a folder to cloud files .