Created
September 25, 2016 22:52
-
-
Save mathewmariani/5051ca876aeaba5feb20bf3db205b794 to your computer and use it in GitHub Desktop.
Useful for removing macOS specific files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from fnmatch import fnmatch | |
# pretty useless if youre using git. | |
root = "./" | |
search = ["._*", ".DS_Store", ".AppleDouble", ".LSOverride"] | |
for (path, dirs, files) in os.walk(root): | |
for name in files: | |
for exp in search: | |
if fnmatch(name, exp): | |
file = os.path.normcase(os.path.join(path, name)) | |
print (file) | |
os.remove(file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment