File > Create Archive and /usr/bin/zip

Discussion in 'Apple' started by dave, Nov 14, 2005.

  1. dave

    dave Guest

    Okay, I love the Finder's new "Create Archive" command
    where I can make entire folder trees into a single zip file
    and make them available on the web without hardly any effort.

    But I want to do the same thing from the command line and
    even though I can probably claim to be an expert in the shell
    having used it every day for 20 years,
    /usr/bin/zip was not available previously in Solaris and
    thus I've not used it in OSX 10.4.2 and it is giving
    unexpected results.

    I have a folder of shell scripts in my current directory
    entitled "daily.backup-3.1". I then use the following command
    to zip it.

    zip -r daily.backup-3.1 daily.backup-3.1

    Why do I then get:

    zip warning: missing end signature--probably not a zip file (did you
    zip warning: remember to use binary mode when you transferred it?)

    zip error: Zip file structure invalid (daily.backup-3.1)

    So I then rename the folder to just "daily" to remove all
    the punctuation in the folder name and, guess what?
    It works without complaint.

    Why is this? Shouldn't /usr/bin/zip be able to handle
    a little standard punctuation???

    Thanks for any wisdom.
     
    dave, Nov 14, 2005
    #1
    1. Advertisements

  2. I'm jumping in with no formal training or a zip man page, but shouldn't
    it be 'zip -r daily.backup-3.1 daily.backup-3.1.zip'
    I doubt I gave you any.

    leo
     
    Leonard Blaisdell, Nov 15, 2005
    #2
    1. Advertisements

  3. I believe that what's happening is will add ".zip" to the supplied zip
    file name unless it already has an extension. Since there is a '.'
    in the name daily.backup-3.1 it assumes you supplied an extension and
    doesn't add one. Then it sees that the "daily.backup-3.1" already
    exists, and assumes that it is an old zip file which should be
    updated.

    I think that if you add ".zip" to the zipfile name it will work as
    expected.
     
    William Mitchell, Nov 15, 2005
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.