getting file from copy

May 6, 2009 at 11:57 AM
hey everyone,

i don't know if its possible to get a file from a copy without mounting it?
by that i mean: you select (with C#) your copy, after that you browse trough the files and if you select a file, you can download it (copy it) from the copy to any folder on your hd

i wonder if it is possible in combination with alphaFS?

greetz Dr.A

May 6, 2009 at 3:43 PM
Edited May 6, 2009 at 3:45 PM
Without AlphaFS I would have to say no. With AlphaFS; but of course ;)
[Edit: Of course it is also possible without AlphaFS, after all, AlphaFS is also written in C#, but it would definately be more cumbersome]

Also check out the AlphaFS discussion forum. There is a question there about mounting a shadow copy as a volume, which is very similar to this.

Use IVssBackupComponents.GetSnapshotProperties to retrieve the SnapshotDeviceObject for your shadow copy. This is the path to the volume, and can be used just as any other path would if you use AlphaFS.

Assuming you have just created a snapshot with the ID gSnapshot, the following should print a list of the files in the root directory of the shadow copy:

            VssSnapshotProperties snapshotProperties = vssBackupComponent.GetSnapshotProperties(gSnapshot);
            string volumeName = snapshotProperties.SnapshotDeviceObject;

            foreach (string file in Directory.GetFiles(volumeName))

P.S. The Directory class in the above example if of course Alphaleonis.Win32.Filesystem.Directory and not System.IO.Directory.

Aug 15, 2011 at 4:41 PM
Edited Aug 15, 2011 at 5:11 PM

You can using something like this:

Declare section:
Private Declare Auto Function CopyFileEx Lib "kernel32.dll" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal lpProgressRoutine As CopyProgressRoutine_Delegate, ByVal lpData As Int32, ByVal lpBool As Int32, ByVal dwCopyFlags As Int32) As Integer

In your procedure:
'sVSSFile = source file path in your snapshot, it could be something like "\\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\temp\test.txt"
CopyFileEx(sVSSFile, sDestFile, m_oCPR, 0, 0, 0) 

I found the code in the Demo code I found somewhere in here ;-)