How to split .zip files and join them in Windows?

44,769

Solution 1

On Ubuntu you can use the split command to split your zip file. Something like this should work:

split your-zip.zip -b 32M ZIPCHUNKS

This will create a bunch of ZIPCHUNKS* files, in order, and all 32 MB or less in size. Change the 32M parameter to vary the chunk size.

Traditionally you'd use cat to glue them back together:

cat ZIPCHUNKS* > reassembled-zip.zip

Since you want to do the reassembling on Windows, you need a substitute for cat. Is there replacement for cat on Windows may help, but note that the Windows type command will not work as it adds the files names between them when processing more than one file. One working approach is copy /b ZIPCHUNKS* > reassembled-zip.zip.

You can also use rar which natively supports creating "split" archives which can then be decompressed by a GUI tool on Windows such as WinZip or WinRar. On Ubuntu, install the rar package, then:

rar a -v32M destination.rar files/to/compress

This will create files called destination.partXX.rar. Transfer these to Windows, then unrar the first one (destination.rar), which will link to the others automatically.

One trick you can potentially use is to "rar" the original zip file, that way you can reassemble it on Windows. If you have the original files, it may be easier to just rar them and work with that.

Solution 2

Use zip command with -s split_size to compress files. The example command is following.

zip -r -s 100m filename.zip  compress_folder

Solution 3

Very easy: you first do split your-zip.zip -b 32M ZIPCHUNKS in Linux/Unix and then type * > myZipFile.zip in Windows.

Share:
44,769

Related videos on Youtube

kunaguvarun
Author by

kunaguvarun

Updated on September 18, 2022

Comments

  • kunaguvarun
    kunaguvarun over 1 year

    I need to split a .zip file in Ubuntu as .z01, .z02 etc... so that I would join them back in Windows.

    I don't have access to command prompt in Windows. How would I unzip files now?

  • kunaguvarun
    kunaguvarun over 11 years
    Thanks for the help on split command as well as the stackoverflow link. Really helpful. I'm wondering now that I don't even have access to command line. How do I unzip the splitted files now?
  • kunaguvarun
    kunaguvarun over 11 years
    Thanks, but I don't have permissions to install any tools where I need to join the files
  • kunaguvarun
    kunaguvarun over 11 years
    Your command ZIPCHUNKS creates ZIPCHUNKSaa, etc.. They are of unknown file type. I wonder whether they'll be detected in windows
  • BlitZz
    BlitZz over 11 years
    The "chunks" are not stand-alone zip files, they need to be put back together in order for the zip file to be valid. I'll update my answer to show a way of doing this with rar, which can produce "chunked" archives (called "volumes) and be decompressed with WinZip (which I hope you have installed) or WinRAR. If not, you'd have to tell me which archive management tools are installed on your Windows system.
  • BlitZz
    BlitZz over 11 years
    yes, the chunks themselves are unrecognizable, I wouldn't trust Windows to detect them as anything, that's why I mentioned you have to reassemble them somehow, then rename the resulting file to .zip. But the pieces themselves will be useless until reassembled.
  • Paddy Landau
    Paddy Landau over 11 years
    In that case, you'll have to use the solution that roadmr gave, using copy /b on Windows.
  • kunaguvarun
    kunaguvarun over 11 years
    Thanks roadmr. I used zip command with --out option and they're recognizable in windows
  • Yaron
    Yaron over 6 years
    Your answer seems to be a copy of @roadmr accepted answer
  • Amir
    Amir over 6 years
    @Yaron No it's not. It's a very straight-forward version of his answer. His answer did not contain the part relevant to gluing the split zip files back in Windows.
  • James Newton
    James Newton almost 5 years
    type will add the file names and formatting when given multiple files. use copy /b *.in file.out instead.