Tuesday, April 5, 2011

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

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 & BinaryWriter, 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.

From stackoverflow
  • 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.

    Scott : I thought this was going to be the answer but thought I'd ask anyway.
  • 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 comments:

Post a Comment