Search code examples
macosbashziptarunzip

I can unzip on a remote machine but not on my computer


On a cluster I zipped a large (61GB, 9.2GB when zipped) directory.

zip -r zzDirectory Directory

I then scp the zzDirectory on my personal computer.

scp -r name@host.com:/path/to/zzDirectory.zip path/in/my/computer/zzDirectory.zip

And finally I unzipped it. I tried to unzip from the bash but it failed

warning [zzDirectory.zip]:  5544449626 extra bytes at beginning or within zipfile
  (attempting to process anyway)
error [zzDirectory.zip]:  start of central directory not found;
  zipfile corrupt.
  (please check that you have transferred or created the zipfile in the
  appropriate BINARY mode and that you have compiled UnZip properly)

So I doubled click on the icon from the finder and the system started to unzip zzDirectory.zip. However, some files are missing and it looks like (I am not 100% sure yet) that some newline characters (\n) are missing as well. unzip used to work fine on my computer before.

In order to investigate where the problem come from, I unzipped zzDirectory.zip on the cluster and everything seem to work fine (no missing files).

I repeated the transfer and unzipped again but the problem persists. Note that transfers are made via internet. My OS is Mac OSX Yosemite 10.10.2.

How can I solve this issue? I would prefer not to transfer data that are not zipped because of band width issue. Do you think I should try to tar or should I use specific options that goes with the unzip command line?


Solution

  • On OS X you could try:

    ditto -x -k the_over4gb.zip /path/to/dir/where/want/unzip
    

    e.g:

    ditto -x -k zzDirectory.zip .