Are Windows file creation timestamps reliable?

I have a program that uses save files. It should download the latest save file, but return to the next new one if it is unavailable or damaged. Can I use the Windows file creation timestamp to indicate the order in which they were created, or is it unreliable? I ask because the “modified” timestamps seem unreliable. I can insert the creation time / date in the name if necessary, but it would be easier to use file system dates if possible.

+3
source share
7 answers

If you have a directory full of arbitrary and randomly named files, and "time" is the only factor, it may be more appropriate to set the file name to the timestamp to eliminate the need to use tools to view it.

2008_12_31_24_60_60_1000  

It would be my recommendation for a flatfile system.

Sometimes, if you have many files, you can group them, for example:

2008/
2008/12/
2008/12/31
2008/12/31/00-12/
2008/12/31/13-24/24_60_60_1000 

or something more

2008/
2008/12_31/

etc. etc.

(Moreover, if you do not embed time, what is your other distinguishing characteristic, you cannot have a null file name, and creating monotonically increasing sequences is much more difficult? Info)

+2
source

""? , , . - FAT16 , 2 . FAT32 NTFS , , 1 . , , . , . , (, , ovekill)

+2

, , , , timestamp .

, , .

+2

Windows UTC. , (.. ), / . , 2 , , , , , . , , .

+1

, - ? , , , - .

: , .

+1

.

- GetFileInfoEx

GetFileAttributesEx, ftCreationTime WIN32_FILE_ATTRIBUTE_DATA. , , , , . FindFirstFile API. 2003.

, ,

+1

,

Path.Combine(ArchivedPath, currentDate + " " + fileInfo.Name))
0

Source: https://habr.com/ru/post/1699028/


All Articles