0

I'm writing a script that processes files in directories, but I want the directories' timestamps to remain the same. So I want to get the timestamp before the operation, then set in back after.

Getting the timestamp is easy enough (os.path.getmtime()), but I can't seem to find an equivalent set method.

Any suggestion?

mrgou
  • 1,576
  • 2
  • 21
  • 45

1 Answers1

0

use os.utime().

Should work fine.

Define variables with date, time and stuff before so the actual setting function doesn't get that cluttered.

Sabri_1
  • 36
  • 3