13 lines
389 B
Python
13 lines
389 B
Python
import datetime, time, os
|
|
|
|
def ageOfFile(pathToFile):
|
|
pathToFile = os.path.expanduser(pathToFile)
|
|
return int(time.time()) - os.path.getmtime(pathToFile)
|
|
|
|
def fileIsOlderThan(pathToFile, days=0, hours=0, minutes=0, seconds=0):
|
|
time= (((days*24) + hours) * 60 + minutes) * 60 + seconds
|
|
return ageOfFile(pathToFile) > time
|
|
|
|
def dirIsEmpty(pathToDir):
|
|
return os.listdir(pathToDir) == []
|
|
|