开发者

Saving create / modify dates of file when writing / restoring a binary filestream

开发者 https://www.devze.com 2023-01-21 21:15 出处:网络
Is it possible to save a file\'s original create / modify dates when saving a file to a db (via filestream & BinaryReader) and then have those dates attached to the file when recreating the file,

Is it possible to save a file's original create / modify dates when saving a file to a db (via filestream & BinaryReader) and then have those dates attached to the file when recreating the file, again via filestream & Bina开发者_运维问答ryWriter, from the db? If possible, how do I do it?

My inital research leads me to believe only the file contents are being stored and retrieved.


You can add database columns for the data you want to save about your file. When you write a file to the database, put this information into the columns. When you read, change file properties according to the data from columns.


As suggested by Athari you can store those times in database columns and when you are recreating the file use System.IO.FileInfo. You can set all the time properties using this.

0

精彩评论

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