Skip to content

Instantly share code, notes, and snippets.

@rougetimelord
Last active August 19, 2019 01:07
Show Gist options
  • Save rougetimelord/07200e1bd8b11d5263628c89bbcd159d to your computer and use it in GitHub Desktop.
Save rougetimelord/07200e1bd8b11d5263628c89bbcd159d to your computer and use it in GitHub Desktop.
from pathlib import Path
import os
root_dir = input("Dir: ")
for root, sub, file in os.walk(root_dir):
if "__MACOSX" in sub:
rm = os.path.join(root, "__MACOSX")
print("rming - " + rm)
os.rmdir(rm)
#pretty sure this isn't needed bc everything is in the _MACOSX folder but idk
#chdir(root_dir)
#for file in Path('.').glob('**/._*') + Path('.').glob('**/*.DS_Store'):
# os.remove(file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment