When you copy a file (in a windows environment), the Creation and LastAccess datetime are modified and can be retrieved with a FileInfo
object.
However, I can't find any reliable datetime (directly linked to a file) that would be changed when a file is moved into a folder. Does windows update any datetime value in the file when it's moved (and can it be retrieved)?
Note I'm not in a dead end and I have many workarounds. I'm just wondering if this could be handled directly at the file level to avoid unnecessary logic.
So this seems to be how this works in Windows:
RoboCopy and RichCopy are couple of command-line tools that can preserve the mtime for directories with the /DCOPY:T switch, but this only works in Vista and newer. Another copy utility which can preserve timestamps is XXCOPY
You can find some example for RoboCopy at the end of this page: http://www.computerhope.com/robocopy.htm
How about using FileInfo's
LastWriteTime
? It looks like it keeps the date from original file