views:

753

answers:

3

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.

+8  A: 

Use the function SetFileTime (C++) or File.SetLastWriteTime (C#) to set the last write time to the current time.

FigBug
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... :)
Brian Knoblauch
+3  A: 

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.

James Curran