My code is :
import time
import os
import os.path
dir = raw_input('Temp files folder directory: ')
deletedFiles = 0
check = True
def checkTempFiles(tempDir):
time.sleep(5) #900 for 15 mins
files_in_dir = os.listdir(dir)
for file_in_dir in files_in_dir:
ext = os.path.splitext(file_in_dir)[1].lower()
if ext != '.php' :
ctime = time.ctime(os.path.getctime(file_in_dir))
if ctime > ctime + 900:
os.remove(ctime > ctime + 900)
deletedfiles += 0
while check == True:
checkTempFiles(dir)
And apparently I get an error on the line:
ctime = time.ctime(os.path.getctime(file_in_dir))
Please help me and thanks in advance. I am trying to get the creation time of the file and check stuff as you see up^. But it doesnt work due to that error and I cant solve it