Created
May 31, 2014 20:39
-
-
Save PHLAK/3a2ab812b5091db2d310 to your computer and use it in GitHub Desktop.
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 | |
import time | |
path = "U:\\Downloads" | |
now = int(time.time()) | |
dirList = os.listdir(path) | |
for fileName in dirList: | |
filePath = path + "\\" + fileName | |
if not os.path.isdir(filePath): | |
modTime = int(os.path.getmtime(filePath)) | |
if now - modTime >= 1209600: | |
print "Deleting %s" % filePath | |
os.remove(filePath) | |
print "Cleanup complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment