Skip to content

Instantly share code, notes, and snippets.

@ztffn
Created February 26, 2024 05:55
Show Gist options
  • Save ztffn/9902b5169ed99e0c58b7598a2cb8dda8 to your computer and use it in GitHub Desktop.
Save ztffn/9902b5169ed99e0c58b7598a2cb8dda8 to your computer and use it in GitHub Desktop.
tiny python script script will go through all subdirs and delete files that matches a specified type
import os
# Put this in a folder. Point Terminal cd to that folder
# Run Terminal prompt: python3 metawipe.py
# the script will go through all subdirs and delete files of ".wipethis"
# By using this script, you acknowledge and agree that you are doing so at your own risk.
# It is highly recommended to back up your data before running this script.
def remove_meta_files(directory):
for root, dirs, files in os.walk(directory):
for file in files:
# Change the extension you want to delete
if file.endswith(".meta"):
file_path = os.path.join(root, file)
os.remove(file_path)
print(f"Removed: {file_path}")
if __name__ == "__main__":
# Use the current directory as the root directory
directory = os.getcwd()
remove_meta_files(directory)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment