The same volume can not be used as both the source and destination.

Jul 16, 2012 at 8:48 PM
Edited Jul 16, 2012 at 8:48 PM

I get the error in Windows 7 zip and 7zip when exctracting splitted archive from directory. I set max size to 5 mb. When archive is smaller everything goes fine, but if splitted only win-rar can extract the archive.

My code is very simple (as in examples):

 

public string DoSplit(int maxSize)
{
            using (ZipFile zip = new ZipFile())
            {
                zip.AddDirectory(_workingPath);
                zip.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression;
                zip.MaxOutputSegmentSize = maxSize; //5mb

                DirectoryInfo commonWorkingDir =  Directory.GetParent(_workingPath);
                DirectoryInfo workingDir = new DirectoryInfo(_workingPath);

                _zippedDirectory = Path.Combine(commonWorkingDir.FullName, workingDir.Name + zippedSuffix);
                Directory.CreateDirectory(_zippedDirectory);
                zip.Save(_zippedDirectory + "/attachments.zip");
            }

            return _zippedDirectory;
        }