gnr gnr - 2 years ago 200
Linux Question

touch a directory in python (Linux)

Is there a way to "touch" a existing directory in Linux using python so that its modtime becomes the current system time?

From the command line this is the equivalent of

touch $directory

Answer Source

os.utime() will allow you to set the atime and mtime of an existing filesystem object, defaulting to the current date and time.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download