Skip to content

Instantly share code, notes, and snippets.

@ChrisCinelli
Last active November 10, 2018 00:43
Show Gist options
  • Save ChrisCinelli/f372134e85a4f3373af972e14df58458 to your computer and use it in GitHub Desktop.
Save ChrisCinelli/f372134e85a4f3373af972e14df58458 to your computer and use it in GitHub Desktop.
Split a file in pieces of 10Mb that can be easily reassembled with 'cat'
#!/bin/bash
# Split files in a bunch of 10Mb files and add .zip (even if they are not zip)
# Why? They can be attached to a issue in Github and overcoming the ;-)
# Use: split10m file
# or tar cJf - folder_to_compress | split10m
gsplit -b 10m -d --additional-suffix=.zip ${1:--} ${2:-archive}
# It can be reconstructed with just:
# $ cat archive*.zip > originalfile
# Or assuming that the file was a .tar.xz file, it can be extract directly:
# $ cat archive*.zip | tar PxJf -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment