Skip to content

Instantly share code, notes, and snippets.

@PHLAK
Created May 31, 2014 20:39
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 PHLAK/3a2ab812b5091db2d310 to your computer and use it in GitHub Desktop.
Save PHLAK/3a2ab812b5091db2d310 to your computer and use it in GitHub Desktop.
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