Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET renaming a file inside a zipped file without unzipping

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

    How can I rename a file inside the zipped file without unzipping it? Is this possible to do? I’m using vb.net.

     

    Thanks

    Imported from legacy forums. Posted by Richard (had 2301 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Richard,

    You can rename a file without unzipping it using the following code snippet:

          Dim file As New DiskFile(“D:\test.zip”)

                      Dim zipArchive As New ZipArchive(file)

                      Dim files() As AbstractFile = zipArchive.GetFiles(True, Nothing)

                      files(0).Name = “new name”

     

     

    Imported from legacy forums. Posted by Mohamed [Xceed] (had 780 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi

    Thanks for responding to me!!

    Quick question, does the code above work with the real time zip control you have? When I run your code I get an error here:

    Dim file As New DiskFile(“D:\test.zip”)

    Say it needs a license, we have the realtime ZIp control for ASP.NET

    Imported from legacy forums. Posted by Robert (had 275 views)

    User (Old forums)
    Member
    Post count: 23064

    anyone?

    Imported from legacy forums. Posted by Robert (had 415 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Robert,

    The code will not work with the Xceed Real-Time Zip for .NET because it does not use the same FileSystem structure as the Xceed Zip for .NET. The Xceed Real-Time Zip for .NET works with streams for better performance. In the ZipItemLocalHeader class, you can change the filename using the FileName property. Please refer to our online documentation here.

    Here is an example how to create a zip archive using the Xceed Real-Time Zip for .NET. In the code, you can see how to manipulate the filename.

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

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