User (Old forums)MemberMarch 24, 2005 at 12:04 pmPost count: 23064
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.
Imported from legacy forums. Posted by Wark (had 4175 views)User (Old forums)MemberOctober 10, 2005 at 2:24 amPost 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)MemberNovember 10, 2005 at 4:41 pmPost count: 23064
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)MemberOctober 13, 2011 at 6:29 amPost 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
Imported from legacy forums. Posted by Robert (had 580 views)Xceed SupportMemberFebruary 18, 2012 at 10:21 amPost count: 5658
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)
- You must be logged in to reply to this topic.