Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I wanted to take a folder full of PDF files and create a number of separate zip files, after following the advice on this question everything worked *almost*perfectly. Here's what happened:

When I issued this command in Terminal:

zip -s 5m -r ~/Desktop/invoices ~/Desktop/Invoices/

Everything worked really well, in that I got 11 ZIP files of approximately 5 MB each; placed in the folder specified.

However, the files they outputted were named as follows:

  • invoices.z01
  • invoices.z02
  • invoices.z03
  • invoices.z04
  • invoices.z05
  • invoices.z06
  • invoices.z07
  • invoices.z08
  • invoices.z09
  • invoices.z10
  • invoices.zip

So as you can see only invoices.zip has been named correctly. I could go through and rename them one by one, but seriously, if we start doing that then what in the name of Evolution are computers for?!

Now, I am also aware that I'm relatively new to the Terminal; so I could be making a very silly mistake somewhere. If that's the case, please be patient :-)

Any help would be greatly appreciated.

One last note: I'm quadriplegic so I would like to avoid GUI applications as much as possible, I use voice recognition software you see this working in the Terminal is much much easier.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

The command did exactly what you want. The fact that the naming seems "off" is unavoidable if this is what you want to do.

The -s switch tells zip to create one archive that holds all the files, and then split it up into chunks of a specified size (in your case 5 megabytes). (The implementation is different, but the effect is the same as if it did this)

In order for the reverse to take place (putting the archive back in one piece) you need to know which part goes where. That is what the numbers after the . tell the program.

If you are trying to do something else, just leave a comment after my answer, or edit your post.

share|improve this answer
    
Hi, thanks for the answer; that explains what's going on really well. I should've explained that the reason I'm trying to do this is that the folder containing the PDF files is 50 MB approximately, and the person I'm sending the documents to as a mail server which will only accept files up to 5 MB in size. So I need to split the 50 MB folder into smaller chunks of no greater than 5 MB in size, which as you have explained is not what I'm doing. Can you point me in the right direction please? –  Panrubius Apr 11 '12 at 9:32
    
No, that is exactly what you are doing. All of the chunks are the right size. You can send them one at a time, and have the person at the other end extract them (only once they have all the parts). I though you might have been looking for a way to put all the files in their own archives (this may violate your size constraint, unless these are split also, and while possible, that seems "messy" to me). You have the right command as is, feel free to use it. –  soandos Apr 11 '12 at 9:39
    
One last question, the person at the other end is not technically minded at all; if they just extract each of these archives by double clicking on them, will they then have access to all of the separate PDF invoices? –  Panrubius Apr 11 '12 at 9:41
    
@Panrubus: It's even easier than that actually. They just extract the .zip file and it will create a folder that contains all of the PDFs. That's the purpose of a multi-part archive rather than having X different separate archives that you need to individually extract. The other person just needs to make sure that all the .z## files are in the same folder when he/she extracts invoices.zip –  Lèse majesté Apr 11 '12 at 9:44
    
@Panrubius If their machine is set up correctly (i.e. the .zip file extension is associated with a program that can open these types of archives) then double clicking invoices.zip will open up all the parts (NOTE: in the simple case all pieces must be downloaded first, though this is not technically speaking necessary) so it will appear that it was always one file, and they can extract as normal. If this answer answers your question, clicking the check mark would be appreciated. –  soandos Apr 11 '12 at 9:45
show 1 more comment

You can also try a for loop.

For /r %i in (*.Pdf) do zip %i)

also consider using the option fast Web view when authoring the pdfs. Fast web view or optimize for online publishing will reduce the overal size.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.