Code:
'FileCopy_test.bas #Dim All Function PBMain () As Long Local SourceFile, DestinationFile, sResult As String SourceFile = "c:\bat\x.bat" <=== create on your drive, or change to an existing folder & file DestinationFile = "c:\copiedx.bat" FileCopy SourceFile, DestinationFile If Err Then MsgBox Str$(Err),,"Error during FileCopy" Exit Function End If MsgBox "Success",,"Done!" End Function
INSTRUCTIONS:
0. Create the folder and file, or change to suitable file on your system.
1. Run this program.
2. From a CMD window, check the creation date: dir c:\copiedx.bat /t:c
- should be the current date/time
(You can leave the CMD window open for upcoming commands.)
3. Use whatever utility tool to change the creation date of the copied file
- I suggest something easily recognized: 2001-11-11 11:11:11
4. Check the creation date: dir c:\copiedx.bat /t:c
- should be the date you just set
5. Run this program again. Keep in mind that we're overwriting the first copy.
6. Check the creation date: dir c:\copiedx.bat /t:c
- should be the current date/time (!!)
7. Now DELETE the copied file.
8. Run this program again, making a new copy of the source file.
9. Check the creation date: dir c:\copiedx.bat /t:c
- should be the current date/time (!!!!!!?????!!!!!!)
MCM,
This ought to be a contest!! (And yes, I figured out the answer.)
In fact, I did 4 or 5 forum searches, read through a dozen threads going back to 2000 on topics that were "close", and didn't find anything about this.
(I'm sure I might have missed something, but the point is that I did a LOT of reading to find a previous encounter with this oddity, and didn't find any hint.)
And yes, I scoured SDK and MSDN...
Good luck!