1

does anyone know how to set the time-stamp of a Linux (text) file to an arbitrary value, not necessarily the current time, using C#?

For example, could I run code to change the timestamp of filepath/foobar to Thu 04 Oct 1995 09:15:00 AM CDT?

Preferably, this would work for both the accessed and modified stamps.

Thank you!

1 Answer 1

1

If I am understanding the question you would want to use File.SetLastWriteTime(). More information on it can be found here http://msdn.microsoft.com/en-us/library/system.io.file.setlastwritetime.aspx

Sign up to request clarification or add additional context in comments.

2 Comments

That does the trick. Is there a similar way to modify the last read time? File.SetLastReadTime doesn't seem to exist.
You should be able to set it with LastAccessTime() msdn.microsoft.com/en-us/library/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.