iEFdev

Code, Computers & Random Junk

Compress, Split and Merge Files

Compress

When/if you work with large files there are times you need to compress the file.

Let say you have a folder with your big file(s). You tar to compress it:

tar -cvzf MyFolderName.tar.gz MyFolderName

I used that recently to compress a virtual disk (.vmdx). It went down from 12.6GB to 5.3GB.

Split

So, that’s good. But the file is still kind of big to send or maybe upload somewhere. In Terminal:

split -b 200m MyFoldeName.tar.gz MyFoldeName.part-

That will create a number of 200MB files with the names:

MyFolderName.part-aa
MyFolderName.part-ab
MyFolderName.part-ac
MyFolderName.part-ad
...etc.

Now they’re more friendly sized to send or upload.

Merge

To put the big file back together again. In Terminal:

cat MyFolderName.part-* > MyFolderName.tar.gz

Comments