ReplaceFile
The ReplaceFile function replaces one file with another file, with the option of creating a backup copy of the original file. The replacement file assumes the name of the replaced file and its identity.
Remark
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
从上面的解释看出,这个函数是非常有用的!