User (Old forums)MemberNovember 30, 2011 at 10:58 amPost count: 23064
I have the following source code which allow me to perform recursive zipping operation on a source folder.
this code work correctly, But if i add the SplitSize option (to create a multivolume archive) i have this error :
Cannot perform the requested operation on an item that does not exist. Type: Xceed.FileSystem.DiskFile FullName: C:\zip.zip
Any help please?
Dim oZipFile As AbstractFile
oZipFile = New DiskFile(“C:\zip.zip“)
Me.oZip = New ZipArchive(oZipFile)
Me.oZip.DefaultCompressionLevel = DirectCast(4, CompressionLevel)
Me.oZip.DefaultTextEncoding = TextEncoding.Unicode
‘Me.oZip.SplitNameFormat = SplitNameFormat.PkZip
‘Me.oZip.SplitSize = MultiVolumeFileSize
If Len(Me.sPassword) > 0 Then
Me.oZip.DefaultEncryptionMethod = EncryptionMethod.Compatible
Me.oZip.DefaultEncryptionPassword = Me.sPassword
‘contains files and subfolders
oDiskFolder = New DiskFolder(“c:\aa\bb”)
RecursiveZip(oDiskFolder, Me.oZip, Nothing, TestSpe(Me.Options, ZipOptions.ZO_OverWrite), True, “\”)
Private Sub RecursiveZip(ByVal oFolder As AbstractFolder, ByVal oZipArch As ZipArchive, ByRef oFilter As Filter, ByVal bOverWriteFlag As Boolean, ByVal bRecursiveFlag As Boolean, ByRef sRootPath As String)
Dim oSubFolders() As AbstractFolder
Dim oFiles() As AbstractFile
Dim oTgtFolder As ZippedFolder = Nothing
If oFilter Is Nothing Then
oFiles = oFolder.GetFiles(False)
oFiles = oFolder.GetFiles(False, oFilter)
If oFiles.Length > 0 Then
oTgtFolder = DirectCast(oZipArch.CreateFolder(sRootPath), ZippedFolder)
For Each oFile In oFiles
If bRecursiveFlag Then
oSubFolders = oFolder.GetFolders(False)
For Each oSubFolder In oSubFolders
RecursiveZip(oSubFolder, oZipArch, oFilter, bOverWriteFlag, True, sRootPath & oSubFolder.Name & “\”)
Imported from legacy forums. Posted by Youcef (had 3569 views)Xceed SupportMemberDecember 6, 2011 at 1:54 pmPost count: 5658
What is the exact version of the Xceed Zip for .NET
that you are using? if you can provide the exact build versions for each
DLL that you are using, that would be appreciated. We can determine if
there was a possible bug in a previous version and that it was fixed in a later version.
Imported from legacy forums. Posted by Marc [Xceed] (had 591 views)User (Old forums)MemberDecember 14, 2011 at 11:57 amPost count: 23064
My Xceed Zip .NET DLL Version is 4.1.11524.1621
Imported from legacy forums. Posted by Youcef (had 289 views)Xceed SupportMemberDecember 14, 2011 at 12:49 pmPost count: 5658
Can you please download the latest version of the Xceed Zip for .NET version 4.3.11524.16210 and check to see if the issue persists? If it does, can you send us a small self contained sample application so that we can investigate it further? You can click here to download it directly.
Imported from legacy forums. Posted by Marc [Xceed] (had 390 views)User (Old forums)MemberDecember 15, 2011 at 9:21 amPost count: 23064
Thank you for your response, i tried to test my code using yout last xceed zip dll, it does not resolve the problem.
To reproduce the problem, please use the attached project
Imported from legacy forums. Posted by Youcef (had 278 views)Xceed SupportMemberDecember 15, 2011 at 3:24 pmPost count: 5658
I was able to run your code and get the program to run and execute properly. It was able to zip the folder and split it. You would need to recheck your code in your application and see if the folders to exist on your computer so that your application can zip the directory. Without an application that reproduces the issue, we will not be able to investigate into this matter further.
Imported from legacy forums. Posted by Marc [Xceed] (had 272 views)User (Old forums)MemberDecember 16, 2011 at 3:09 amPost count: 23064
please try this code, i just removed the TRY CATCH bloc.
I reproduce the problem every time !
Imported from legacy forums. Posted by Youcef (had 403 views)Xceed SupportMemberDecember 19, 2011 at 8:24 amPost count: 5658
It’s a bug.
It is caused by your call to CreateFolder() in your RecursiveZip() method.
call serves no purpose. When you call oFile.CopyTo() in your loop just
after, the component will make sure ‘oTgtFolder’ exists in the archive
so the explicit call is not necessary.
By calling CreateFolder()
manually, you are asking the component to create a folder entry in the
zip archive. That folder entry is not necessary and will only increase
the size of your archive without any benefit.
So, it is better to replace the line
oTgtFolder = DirectCast(oZipArch.CreateFolder(sRootPath), ZippedFolder)
oTgtFolder = DirectCast(oZipArch.GetFolder(sRootPath), ZippedFolder)
That way, your code should work.
there is a bug in the component where when CreateFolder() is called on a
new split ZipArchive, the component mistakenly places the internal
logical folder entry in the wrong intermediary storage file. When the
archive is finalized, the logic error is discovered and an exception is
I have fixed the issue and I will create a new beta build containing the fix today.
Thanks for reporting this. We’ve added this scenario to our test suite.
Imported from legacy forums. Posted by Marc [Xceed] (had 253 views)Xceed SupportMemberDecember 19, 2011 at 3:04 pmPost count: 5658User (Old forums)MemberDecember 21, 2011 at 5:14 amPost count: 23064
I have tested your solution, I have replaced the CreateFolder Method by th GetFolder and it works well.
I have also tested the new beta build using the two methods and it works well.
In my solution, i am forced to use the createfolder method to preserve empty folder when zipping files (see explication below), I wonder if I can use your beta build in production?
By the way,
I used a recursive code for zipping my files to manually handle empty folders (which are very important in our applications structure) and to manage excluded files or folders.
using the copyfiles method does not include the emptyfolders in the
destination path. I tried also to use the CopyTo Method which preserve
empty folders but it copies the hall root folder. There is no method allows copying the content of a folder with preserving empty folders.
I have seen in your Zip Forum that your old C++ versions included the “excludedfiles” option
I would like to know if your next versions will include new options to make these treatments directly?
Imported from legacy forums. Posted by Youcef (had 718 views)Xceed SupportMemberJanuary 10, 2012 at 9:34 amPost count: 5658
Yes, you can use the DLLs in your production application before waiting for an update.
your point is well taken. To that end, I’ve added 2 new methods:
AbstractFolder.CopyItemsTo() and AbstractFolder.MoveItemsTo(). They work
just like CopyFilesTo and MoveFilesTo but they each include empty
subfolders as well as files.
You should find them useful.
You can get the build that includes these new methods here:
Imported from legacy forums. Posted by Marc [Xceed] (had 187 views)User (Old forums)MemberJanuary 10, 2012 at 10:07 amPost count: 23064
Thank you for your response.
I will use these new methods when the new major release will be available. I will give you my feedback.
I hope also that you will plan to develop methods to exclude files and/or folders.
Imported from legacy forums. Posted by Youcef (had 1695 views)Diane [Xceed]ModeratorJanuary 15, 2013 at 2:44 pmPost count: 1353
The fix for these issues are now included in the latest official version, which can be downloaded in our Updates Center
Fixed a bug where an ItemDoesNotExistException was thrown when AbstractFolder.CreateFolder() or FileSystemItem.Create() was called during creation of a new split ZipArchive.
Added AbstractFolder.CopyItemsTo() and AbstractFolder.MoveItemsTo() methods to allow easy copy/move operations that include empty subfolders.
Imported from legacy forums. Posted by Diane [Xceed] (had 2162 views)
- You must be logged in to reply to this topic.