I remember there was a WinAPI function which copied the "date modified" property of the previous file which was replaced with it or something like that? Perhaps anyone can tell me about it?
The problem occured when you used that function very 开发者_如何学编程frequently.
This is ReplaceFile (Windows 2000 and up):
The ReplaceFile function combines several steps within a single function. An application can call ReplaceFile instead of calling separate functions to save the data to a new file, rename the original file using a temporary name, rename the new file to have the same name as the original file, and delete the original file. Another advantage is that ReplaceFile not only copies the new file data, but also preserves the following attributes of the original file:
- Creation time
- Short file name
- Object identifier
- DACLs
- Encryption
- Compression
- Named streams not already in the replacement file
Not too clear exactly what you want, but it seems your after SetFileTime
to edit and GetFileTime
to copy, combining the two you can do exactly as 'described/wanted'
精彩评论