Home › Forums › ActiveX components › Xceed Zip for ActiveX & x64 › Rename file inside archive
-
AuthorPosts
-
#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)
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)
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)
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)
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)
-
AuthorPosts
- You must be logged in to reply to this topic.