Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET MultiVolume Zip problems

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #20432 |

    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?

    Thank you.

     

    Code:

    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
    End If
       
        ‘contains files and subfolders
        oDiskFolder = New DiskFolder(“c:\aa\bb”)
       
    Me.oZip.BeginUpdate()
    RecursiveZip(oDiskFolder, Me.oZip, Nothing, TestSpe(Me.Options, ZipOptions.ZO_OverWrite), True, “\”)
    Me.oZip.EndUpdate()

    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)
        Else
            oFiles = oFolder.GetFiles(False, oFilter)
        End If
        If oFiles.Length > 0 Then
            oTgtFolder = DirectCast(oZipArch.CreateFolder(sRootPath), ZippedFolder)
            For Each oFile In oFiles
                oFile.CopyTo(oTgtFolder, bOverWriteFlag)
            Next
        End If
        If bRecursiveFlag Then
            oSubFolders = oFolder.GetFolders(False)
            For Each oSubFolder In oSubFolders
                RecursiveZip(oSubFolder, oZipArch, oFilter, bOverWriteFlag, True, sRootPath & oSubFolder.Name & “\”)
            Next
        End If
           

    End Sub

    :

    Imported from legacy forums. Posted by Youcef (had 3569 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Youcef,

    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)
    Member
    Post count: 23064

    Hello

    My Xceed Zip .NET DLL Version is 4.1.11524.1621

     

    Thx

    Imported from legacy forums. Posted by Youcef (had 289 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Youcef,

    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)
    Member
    Post count: 23064

    Hello

    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

     

    Thank you.

    Imported from legacy forums. Posted by Youcef (had 278 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Youcef,

    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)
    Member
    Post count: 23064

    Hello Marc

    please try this code, i just removed the TRY CATCH bloc.

    I reproduce the problem every time !

    Thank you

    Imported from legacy forums. Posted by Youcef (had 403 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Youcef,

    It’s a bug.

    It is caused by your call to CreateFolder() in your RecursiveZip() method.

    That
    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)

    with

    oTgtFolder = DirectCast(oZipArch.GetFolder(sRootPath), ZippedFolder)

    That way, your code should work.

    Still,
    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
    thrown.

    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 Support
    Member
    Post count: 5658

    Hi Youcef,

    The lead developer of the component has released a beta build version here:

    http://xceed.com/CS/forums/thread/26565.aspx

    Can you check if the built DLLs will fix the issue on your end?

    Imported from legacy forums. Posted by Marc [Xceed] (had 457 views)

    User (Old forums)
    Member
    Post count: 23064

    Hello

    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.

    Currently,
    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?

     

    Thank you

    Youcef

    Imported from legacy forums. Posted by Youcef (had 718 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Youcef,

    Yes, you can use the DLLs in your production application before waiting for an update.

    Yes,
    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:
    http://xceed.com/CS/forums/thread/26565.aspx

    Imported from legacy forums. Posted by Marc [Xceed] (had 187 views)

    User (Old forums)
    Member
    Post count: 23064

     Hello

     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.

     Best Regards

    Youcef

    Imported from legacy forums. Posted by Youcef (had 1695 views)

    Diane [Xceed]
    Moderator
    Post 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)

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.