Saturday, October 8, 2016

Compressing and splitting folder archives

This isn't exactly about tar.gz files in particular - more like what to do when they're too big to upload into github...i.e., this is how to split them into pieces. 

Compress the folder into a gzip archive (all you need when compressing a single folder):
gzip -c my_large_file | split -b 1024MiB - myfile_split.gz_
If the folder has already been compressed, here's the command for splitting it:
split -b 1024m "file.tar.gz" "file.tar.gz.part-"
Apparently, recombining is a good use for the cat command.  Pipe that output to gunzip and you won't have to create an intermediary archive file before decompression. 
cat myfile_split.gz_* | gunzip -c > my_large_file
Basically, by using the pipes you avoid ever letting the unsplit archive sit on your drive.  

I found the answer here.







No comments:

Final post here

I'm switching over to github pages .  The continuation of this blog (with archives included) is at umhau.github.io .  By the way, the ...