1

My application currently uses a third party API that has a bug forcing me to build it in 32bit. Unfortunately this conflicts with Window's Volume Shadow Copy as this apparently must be run in 64bit to work.

Are there any alternatives to VSS I can use to safely backup files that are currently being used by another process?

stivlo
  • 83,644
  • 31
  • 142
  • 199
  • You might want to consider splitting your application into separate 32-bit and 64-bit processes. With the right design it shouldn't be too messy. – Harry Johnston Aug 23 '11 at 22:34

1 Answers1

1

Depending on your requiremen you can do something as simple as this:

FileStream fStream = new FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
StreamReader FileReader = new StreamReader(fStream, Encoding.UTF8);

This will work in some situtions, as it can read locked files. But i strongly recommend that you figure out your requirements first and post here.

IE are we talking about 2gb files that have data written to them in "random" locations? Or 2mb log files that are appended with new data every now and then?

EKS
  • 5,543
  • 6
  • 44
  • 60
  • All of the files I need to backup are very small in size. Most of them are only a few kilabytes in size, and the larger ones are 10-20MB. Would it be safe to use FileStream for backing these up? –  Aug 23 '11 at 10:32
  • It depends on how the data is written to the files, and also you should test if it works. It all depends on how the application locks access to the files – EKS Aug 23 '11 at 10:57