added sync mode for local to swift, added delete function in utility, added script to remove all 0bytes directories, added script to delete large files without manifest
This commit is contained in:
22
utility.py
22
utility.py
@@ -234,6 +234,10 @@ def set_dash():
|
||||
|
||||
|
||||
def delete_object (swift_conn,swift_container,object,manifest,fail_tries):
|
||||
errors_deleting_file = 0
|
||||
errors_deleting_files_of_large_obj = 0
|
||||
skipped_file = 0
|
||||
skipped_files_of_large_obj = 0
|
||||
for fail_tries_counter in range (fail_tries) :
|
||||
try:
|
||||
print("Deleting " + swift_container + "/" + object)
|
||||
@@ -254,9 +258,11 @@ def delete_object (swift_conn,swift_container,object,manifest,fail_tries):
|
||||
except Exception as e:
|
||||
print("Exception during deletion of manifest files")
|
||||
print(e)
|
||||
errors_deleting_files_of_large_obj +=1
|
||||
time.sleep(1)
|
||||
if fail_tries_counter1 == fail_tries - 1 :
|
||||
print("Maximum tries reached. Can't delete " + swift_container + "/" + object +" manifest files.Skipping")
|
||||
skipped_files_of_large_obj += 1
|
||||
else:
|
||||
swift_conn = authentication.set_authentication ()
|
||||
else :
|
||||
@@ -264,12 +270,26 @@ def delete_object (swift_conn,swift_container,object,manifest,fail_tries):
|
||||
except Exception as e:
|
||||
print("Exception during deletion of file")
|
||||
print(e)
|
||||
errors_deleting_file += 1
|
||||
time.sleep(1)
|
||||
if fail_tries_counter == fail_tries - 1 :
|
||||
print("Maximum tries reached. Can't delete " + swift_container + "/" + object +".Skipping")
|
||||
skipped_file +=1
|
||||
else:
|
||||
swift_conn = authentication.set_authentication ()
|
||||
else :
|
||||
break
|
||||
return swift_conn
|
||||
return [swift_conn,errors_deleting_file,errors_deleting_files_of_large_obj,skipped_file,skipped_files_of_large_obj]
|
||||
|
||||
|
||||
def list_compute_0_byte_folders (objects):
|
||||
|
||||
remotefiles = []
|
||||
|
||||
for o in objects :
|
||||
if o["content_type"] == "application/directory" and int(o["bytes"]) == 0:
|
||||
remotefiles.append(o["name"])
|
||||
|
||||
return remotefiles
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user