jmhobbs

Sneaker-netting Huge Files with split and cat

Big files happen, and sometimes they need to be moved.

I've found that moving big files between local computers is often fastest with a USB drive and my shoes, especially since I don't really have access to a wired network usually.

But sometimes, files are just too big for your thumb drive. Some of us don't carry huge drives around, I usually only have a spare 2GB on me.

Suppose you have a 4.4GB ZIP file (don't ask, just suppose). I've only got a 2GB (1.9GB usable) thumb drive on me, but I need to move it over to another machine and I don't have all day.

In the past I've use dd tricks, but I knew there had to be a better way.

Enter split and cat. cat concatenates files, and it's cousin split, well, splits them.

Perfect! Just what I needed! I'll split my file into chunks with split, sneaker it over the other machine and cat it all back together.

Split

computer-one $ split -b 1500M big.zip
(...wait...)
computer-one $ ls -l
-rw-rw-r--  1 jmhobbs jmhobbs 1572864000 2012-02-27 14:44 xaa
-rw-rw-r--  1 jmhobbs jmhobbs 1572864000 2012-02-27 14:45 xab
-rw-rw-r--  1 jmhobbs jmhobbs 1572864000 2012-02-27 14:46 xac
-rw-rw-r--  1 jmhobbs jmhobbs    7637844 2012-02-27 14:46 xad
computer-one $

Move

Sneaker

Join

computer-two $ cat xaa xab xac xad > big.zip
(...wait...)
computer-two $

Enjoy!

computer-two $ ls -l
-rw-rw-r--  1 jmhobbs jmhobbs 4726229844 2012-02-27 15:02 big.zip