Created
March 15, 2019 05:51
-
-
Save pwnchaurasia/5507e0a6a0be34d5445caebdd3c1473e to your computer and use it in GitHub Desktop.
To recursively delete files with a specific extensio
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
| import os | |
| def caller(): | |
| for (root,dirs,files) in os.walk(os.getcwd(), topdown=True): | |
| for file in files: | |
| if file.endswith('.url') or file.endswith('.txt'): | |
| print(os.remove(os.path.join(root, file))) | |
| caller() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment