Skip to content

Instantly share code, notes, and snippets.

@rjsnh1522
Created March 15, 2019 05:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjsnh1522/5507e0a6a0be34d5445caebdd3c1473e to your computer and use it in GitHub Desktop.
Save rjsnh1522/5507e0a6a0be34d5445caebdd3c1473e to your computer and use it in GitHub Desktop.
To recursively delete files with a specific extensio
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