Obviously it gets updated during a write operation, but are there any non-destructive operations that also force an update? Basically looking to be able to do the equivalent of the *nix touch command, but in C# programmatically.
From stackoverflow
-
Use the function SetFileTime (C++) or File.SetLastWriteTime (C#) to set the last write time to the current time.
Brian Knoblauch : Excellent, thanks much! I figured it would be simple, but I'm still learning my way around the .Net framework... Sometimes even simple things can be hard to find... :) -
System.IO.File.SetLastWriteTime(string path, DateTime lastWriteTime);
-
From .NET, use the LastWriteTime property of the FileSystemInfo object. There is, in fact, a complete Touch app in example of that property in the MSDN.
0 comments:
Post a Comment