Question

How would I go about copying a folder (and contents of the folder) from inside of a zip and moving the copied version of the folder to a different location?

I did not see any function in QuaZipDir that allows you to do this. I am hoping there is an easier way than parsing the files and then creating & writing.

For example if the zip looked like this:

  • ZIP
    • Folder
      • File #1
      • File #2
      • File #3

I am, again, using QuaZIP with Qt

Was it helpful?

Solution

Logically, you could extract the files you want to copy to a temporary location on your hard disk and then copy them back to your zip file in the new location. After you copy to the new location from the temporary location, you can delete your temporary files. I think this is what many file compression tools do for file manipulation. Theoretically, you could copy the files to memory and then add them from memory into the new location in your zip file, but this could be dicey for larger files that won't fit in RAM. I would let the operating system handle the buffering to/from disk and not try to implement your own.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top