INV / scripts /cleanup_bak_files.py
Fred808's picture
Upload 256 files
7a0c684 verified
import os
import glob
def cleanup_bak_files():
root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
bak_files = glob.glob(os.path.join(root_dir, '**/*.bak'), recursive=True)
if not bak_files:
print("No .bak files found.")
return
print(f"Found {len(bak_files)} .bak files:")
for bak_file in bak_files:
try:
os.remove(bak_file)
print(f"Deleted: {bak_file}")
except Exception as e:
print(f"Error deleting {bak_file}: {e}")
print("\nCleanup complete.")
if __name__ == "__main__":
cleanup_bak_files()