Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What can change a file created/modified date?

Tags:

c#

file

windows

I'm using a file modified date as a base for file names in via C#. My question is what can make the modified date to change? I actually thought the modified date was the created date first. But the created date is changing when I move the file from USB to harddrive. So I had to use the modified date which has the correct, untoched date.

As I thought when the file was moved the modified date was changed but its actually the created date that is changed in Windows 7 at least.

Is there any use case that may change the date of the file (except unpacking it from a zipped file) surprisingly? Like maybe from DVD to harddrive or something like that?

Best regards Mr Rob

like image 581
Cyrix Avatar asked Sep 03 '25 04:09

Cyrix


1 Answers

File properties with regards to the date and time stamps

  • If you copy a file from C:\fat16 to C:\fat16\sub, it keeps the same modified date and time but it changes the created date and time to the current date and time.
  • If you move a file from C:\fat16 to C:\fat16sub, it keeps the same modified date and time and keeps the same created date and time.
  • If you copy a file from C:\fat16 to D:\NTFS, it keeps the same modified date and time but changes the created date and time to the current date and time.
  • If you move a file from C:\fat16 to D:\NTFS, it keeps the same modified date and time and keeps the same created date and time.
  • If you copy a file from D:\NTFS to D:\NTFS\SUB, it keeps the same modified date and time but changes the created date and time to the current date and time.
  • If you move a file from D:\NTFS to D:\NTFS\SUB, it keeps the same modified date and time and keeps the same created date and time.
  • In all examples, the modified date and time of a file does not change unless a property of the file has changed. The created date and time of the file changes depending on whether the file was copied or moved.

For more information see KB299648.

like image 79
Ruslan Garipov Avatar answered Sep 04 '25 20:09

Ruslan Garipov