Explorar o código

Delete bucket files not present on disk

DricomDragon %!s(int64=4) %!d(string=hai) anos
pai
achega
e46225bbc8
Modificáronse 1 ficheiros con 12 adicións e 0 borrados
  1. 12 0
      boto-updater.py

+ 12 - 0
boto-updater.py

@@ -36,3 +36,15 @@ for file_name in local_file_list:
 
 print("Done")
 
+# Delete files
+print("Deleting removed files ...")
+for file_name in bucket_file_list:
+    print(file_name, end=' ')
+
+    if file_name in local_file_list:
+        print('(Still present)')
+    else:
+        s3.delete_object(Bucket=bucket_target, Key=file_name)
+        print('(Deleted)')
+
+print("Done")