Created
January 3, 2020 16:47
-
-
Save claudijd/dc59339bb1572360f1b574b9730c0648 to your computer and use it in GitHub Desktop.
Clean downloads
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 glob | |
import os | |
import os.path | |
import shutil | |
mydir = "/Users/jclaudius/Downloads/" | |
filelist = glob.glob(os.path.join(mydir, "*")) | |
for f in filelist: | |
if os.path.isdir(f): | |
shutil.rmtree(f) | |
else: | |
os.remove(f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment