Home Forums ActiveX components Xceed Zip for ActiveX & x64 Rename file inside archive

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

    Hi everybody

    For example, I have an archive with the only file ‘file.txt’. Every night I need to archive a fresh copy of this file, but I also need to keep an old copy with another name, let’s say ‘file_Mar_24.txt’.
    Is there any chance to rename it right inside the archive or I have to extract it to the temporary directory first, rename it and re-compress again? Any code examples will be very appreciated.

    Thank you!

    Imported from legacy forums. Posted by Wark (had 4175 views)

    User (Old forums)
    Member
    Post count: 23064

    I’d like to know the answer to this as well. How do you rename an existing file in the Zip file?

    Imported from legacy forums. Posted by Michael (had 550 views)

    User (Old forums)
    Member
    Post count: 23064

    Hello,

    If you look at the convert method : http://doc.xceedsoft.com/products/Zip/sources/convert_method.htm, you can use the Convert Preprocessing event that will allow you to give a different name for the destination file. Granted, the performance won’t be mind blowing (since it will actually rebuild a zip file)but it’s a start.

    At the time being, this is the only option available, Xceed Zip for .NET would however, allow you to do this quite easily :).

    Imported from legacy forums. Posted by Matt (had 3620 views)

    User (Old forums)
    Member
    Post count: 23064

    looks like the link you sent us dont work, can you please resend a link where I can rename a filename within a ZIP file.

    or better still some code to show you how to rename the file names AFTER the files have been zipped

    thanks

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

    Xceed Support
    Member
    Post count: 5658

    Hi Robert,

    Perhaps the best way to go is to use the GetZipContents method to access the files in the archive. You can then change the Filename property to your liking. The method will return a collection of ZipItemObjects. You can then access any file you want by checking its Filename property. Here is the link to the ZipItemObject object. Here is the link to the online documentation for code on how to call the GetZipContents method and how to loop through the collection.

    I hope this helps

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

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