开发者

Batch backup a harddrive without modifying access times C#

I'm trying to write a simple program that will backup my flash drive. I want it to work automatically and silently in the background, and I also want it to be as quick as possible. The thing is, resetting all the access times is useless to me, and something I want to avoid. I know I can read the access times and set them back, but I bet it will fail one day in the 开发者_开发知识库future. It would be much simpler to read the files without ever changing it. Also, what is the fastest way to do this? What differences would there be between, say, a flash drive and an external hard drive.

I am writing this in C#, as it is the simplest way to do it and it will probably last more generations of Windows..


That's not a logical assumption. The FileInfo.LastAccessTime property is frozen in the .NET specification, it is sure to outlast your C# code. If there will ever be a version of Windows that for some mysterious reason doesn't support a last-accessed time stamp on a file then it will be Microsoft's burden to re-implement the property in a reasonable way. The semantics of the property are frozen too, and have been for the past 17 years, there will never be a version of Windows that lets you read from a file but not update the value.

Btw, you should also reset the FileAttributes.Archive bit.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜