questions about updating a zip file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting questions about updating a zip file
# 1  
Old 03-09-2012
questions about updating a zip file

hi all,

I have millions of zip files about 200M each, and i'm trying to add a couple of small files(jpg txt etc.) into these zip files, less than 100k.

when i'm doing this, is it gonna unzip all 200M large files, add files and re zip again? or just add new small ones in?

i'm concerned with the processing time, and want this add processing instant.

thanks for anyone who can clarify for me
# 2  
Old 03-09-2012
Depends what you mean by "zip file".

If you mean zip file as in an honest-to-goodness, pkware-compatible, old-fashioned .zip file as created by the zip and unzip commands, then yes. Files in .zip archives are compressed individually, not collectively, and the .zip contains a table of contents which can be quickly and easily modified and extended after the file is created.

If you mean a "zip file" as in some sort of compressed stream/blob like a .tar.gz or .tar.bz2, then no, you'll have to decompress it first.

These different approaches have advantages and disadvantages. .zip's ability to be modified is useful in situations like yours, but makes it impossible to stream in a pipe chain. It's also poor at preserving file permissions. tar on the other hand does an excellent job of preserving ownership and permissions, and can be streamed over pipes and network sockets.

In general, there's nothing really wrong with .zip if you don't need streaming and don't care about preserving file permissions.

Last edited by Corona688; 03-09-2012 at 12:55 PM..
This User Gave Thanks to Corona688 For This Post:
# 3  
Old 03-09-2012
thanks for your reply.
i mean the old fashion .zip file
# 4  
Old 03-09-2012
The only worry I'd have about modifying the same file repeatedly is that the table of contents must be changed, every time. It's not simply adding to the end. Mess up the table of contents and the file's entire contents could be unrecoverable. Be extremely careful to prevent more than one thing from accessing the file simultaneously. This even includes reads, because the table of contents changing in mid-read could cause confusion or worse to the program reading it.

Splitting among a few zips to reduce the potential for damage, and of course keeping backups, may be wise.
This User Gave Thanks to Corona688 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Updating in file

hi, i have an csv(which is a month's log file containing userid and log in date ) file which has to be appended to another file say master.log.I need to compare the next month's log data to master.log file .In case, there is new log date for userid it has to get updated in master.log file or i... (2 Replies)
Discussion started by: preema
2 Replies

2. Shell Programming and Scripting

How can we Zip multiple files created on the same date into one single zip file.?

Hi all i am very new to shell scripting and need some help from you to learn 1)i have some log files that gets generated on daily basis example: i have abc_2017_01_30_1.log ,2017_01_30_2.log like wise so i want to zip this 4 logs which are created on same date into one zip folder. 2)Post zipping... (1 Reply)
Discussion started by: b.saipriyanka
1 Replies

3. UNIX for Beginners Questions & Answers

How can we Zip multiple files created on the same date into one single zip file.?

Hi all i am very new to shell scripting and need some help from you to learn 1)i have some log files that gets generated on daily basis example: i have abc_2017_01_30_1.log ,2017_01_30_2.log like wise so i want to zip this 4 logs which are created on same date into one zip folder. 2)Post zipping... (2 Replies)
Discussion started by: b.saipriyanka
2 Replies

4. Shell Programming and Scripting

Zip Multiple files to One .zip file in AIX system

Hi I have a requirement in unix shell where I need to zip multiple files on server to one single .zip file. I dont see zip command in AIX and gzip command not doing completely what I want. One I do .zip file, I should be able to unzip in my local Computer. Here is example what I want... (9 Replies)
Discussion started by: RAMA PULI
9 Replies

5. UNIX for Advanced & Expert Users

Zip file inside Zip file(s)

I've a zip file called Z00.zip and in that file there are 22 more zip files. Each zip file having .txt files nearly 10,000 files. I am trying to unzip all these .txt files in one command line to unzip each .zip file from Z00.zip file. Would like to know whether possible to unzip all sub-zip files... (1 Reply)
Discussion started by: nvkuriseti
1 Replies

6. UNIX for Dummies Questions & Answers

Zip a file with .zip extension.

Hi, I need to zip a .dat file with .zip extension. I tried using the "zip" command. But shell says. "ksh: zip: not found" Currently I am using gunzip to zip and changing the extension ".gz" to ".zip" as follows. mv $file `echo $file | sed 's/\(.*\.\)gz/\1zip/'` But when I tried... (1 Reply)
Discussion started by: aeroticman
1 Replies

7. AIX

ZIP multiple files and also specify size of zip file

I have to zip many pdf files and the size of zip file must not exceed 200 MB. When size is more than 200 MB then multiple zip files needs to be created. How we can achieve this in UNIX? I have tried ZIP utility but it takes a lot of time when we add individual pdfs by looping through a... (1 Reply)
Discussion started by: tom007
1 Replies

8. Shell Programming and Scripting

awk updating one file with another, comparing, updating

Hello, I read and search through this wonderful forum and tried different approaches but it seems I lack some knowledge and neurones ^^ Here is what I'm trying to achieve : file1: test filea 3495; test fileb 4578; test filec 7689; test filey 9978; test filez 12300; file2: test filea... (11 Replies)
Discussion started by: mecano
11 Replies

9. UNIX for Dummies Questions & Answers

unzip .zip file and list the files included in the .zip archive

Hello, I am trying to return the name of the resulting file from a .zip archive file using unix unzip command. unzip c07212007.cef7081.zip Archive: c07212007.cef7081.zip SecureZIP for z/OS by PKWARE inflating: CEP/CEM7080/PPVBILL/PASS/G0063V00 I used the following command to unzip in... (5 Replies)
Discussion started by: oracledev
5 Replies

10. AIX

Updating a File in a Zip Archive

Hello everyone, I have a script that pulls a text file out of a zip archive and updates the file. What I need to do is put it back in the zip archive and replace the old one, but I am having no luck. Everything I search on forums or internet points to the command zip, that command is not... (6 Replies)
Discussion started by: dbridle
6 Replies
Login or Register to Ask a Question