'Original creation date of a copied file

I have a copy of a previously generated file and want to detect the creation date of that original file.

I can use the following code to get the creation date of that copy, but not of the original file:

import os.path, time
print("last modified: %s" % time.ctime(os.path.getmtime(file)))
print("created: %s" % time.ctime(os.path.getctime(file)))

Source: http://www.aitek.ch/how-to-get-file-creation-modification-date-times-in-python/

But this will only retrive the creation date of the copy, not the creation date of the original file. I have read that if you copy a file on windows the old creation date will be the new modified date and the date of the copy will be the new creation date. I have also read that in the metda date there might be a real original file creation date but it seems I am unable to find it.



Solution 1:[1]

This is really a Windows thing. Windows does not preserve the creation_time in the copied file of the original file.

The modification time is copied. The creation time is always the current system time.

I think the best you can do is retrieve the original (if possible at all) and take the creation time from the original file.

There are also some tricks you may use, but it really depends on your situation whether they meet your needs: https://superuser.com/questions/146125/how-to-preserve-file-attributes-when-one-copies-files-in-windows

Solution 2:[2]

This is an operating system dependant issue. It all depends on the fact that while copying the files we ensure the creation date is preserved. On Windows, pressing shift while copying preserves the creation date. Failing that, the file system will not retain the original creation date. You may have to ressort to the meta data stored in the file itself which is file format dependant.

Solution 3:[3]

For .m4a, .3gp, and .mp4 files created on an Android phone, and then copied to a Windows machine:

  1. Right click - select Properties
  2. Click the Details tab
  3. Look for the Origin section
  4. Find Media created

enter image description here

For an image such as a .jpg on an Android captured by the camera, same procedure as above except find Date taken

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2
Solution 3 CSSBurner