-1

File create/modify time has important information. When converting a file into new file, such as video, how to preserve create/modify time in Python. Something like:

# pseudo code
old_time = original_video.gettime()

# new_video and original_video are totally different files.
new_video = create_and_convert(original_video)

# How to copy old file create/modify time to new file?
set_time(new_video, old_time)

I wish new_video has exact same create/modify time. How to do it?

user3792705
  • 577
  • 3
  • 18

1 Answers1

0

Use time module for your usecase.

import time
old_time = time.ctime()
Abercrombie
  • 1,012
  • 2
  • 13
  • 22