Created
January 25, 2019 00:58
-
-
Save iris9112/f03520409f9ff97ee6d5c7ccd8a0fde3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
""" | |
delete all compiled binaries files | |
""" | |
import os | |
import argparse | |
def delete_binaries(folder_path=None): | |
""" | |
delete binaries given a folder, if not given, | |
delete migration_files under current folder directory | |
""" | |
# find all binary folders | |
if not folder_path: | |
folder_path = os.getcwd() | |
for a,b,c in os.walk(folder_path): | |
if a.endswith('__pycache__'): | |
# find all binary files | |
migration_files = [f for f in c if f.endswith('.pyc')] | |
for f in migration_files: | |
print(os.path.join(a, f)) | |
# delete binary files | |
os.remove(os.path.join(a, f)) | |
if __name__ == '__main__': | |
delete_binaries() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment