Now, the content of each file is no longer fully read into memory, but directly copied into a zip file through io. Copy(). Before the loop, we created the target file and reused the file handle in the loop, thereby reducing disk write operations. Finally, during export, we use the defer statement to release resources and ensure that these resources are properly closed before the program exits