0

I am developing code in python that should compare the date of the files in the folder to the current date. But I Can't get dates of the files can you help me ?

1 Answers1

0

You could iterate through the files with something like this:

import os.path, time
print("Created: %s" % time.ctime(os.path.getctime("filename.txt")))

to get the dates of the files.

to get the current date you could use

from datetime import datetime
now = datetime.now()
current_time = now.strftime("%H:%M:%S")
print("Current Time =", current_time)

and then compare them in the format you want

clanky1997
  • 82
  • 6