Welcome to the Xceed Community | Help
Community Search  
More Search Options

Rename file inside archive

Sort Posts: Previous Next
  •  03-24-2005, 12:04 PM Post no. 5525

    Rename file inside archive

    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!
  •  10-10-2005, 2:24 AM Post no. 5526 in reply to 5525

    Re: Rename file inside archive

    I'd like to know the answer to this as well. How do you rename an existing file in the Zip file?
  •  11-10-2005, 4:41 PM Post no. 5527 in reply to 5526

    Re: Rename file inside archive

    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 :).
    Mathieu Drimonakos
    -Technical Designer-
  •  10-13-2011, 6:29 AM Post no. 31206 in reply to 5527

    Re: Rename file inside archive

    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

  •  02-18-2012, 10:21 AM Post no. 31708 in reply to 31206

    Re: Rename file inside archive

    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


    Marc

    Developer in Technical Support
    Xceed - Multi-talented components - http://xceed.com
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.