Sometimes you might have a very large file that you want to email or FTP to someone, but your email server limits you to small size attachments. The good news is that this is very easy to do with the tools already on your computer. The bad news is that you may have to learn a little about Terminal and the Bash command line utilities. Remember, learning can keep you young!

The two utilities we will use are ‘split’ and ‘cat’. ‘split’ will create little pieces from the big file. ‘cat’ will put all the pieces back together again. If only the King’s men had used this for Humpty Dumpty! As an example, here are the steps necessary for a 94 MB file named MyDatabaseBackup.dat residing in our Documents folder:

1. Open a Terminal window by starting Terminal from our Applications folder.
2. Navigate to the directory containing the really big file:

Last login: Fri Sep 12 16:45:00 on ttys002
mylaptop:~ iggy$ cd Documents/
mylaptop:Documents iggy$ ls -la MyDatabaseBackup.dat
-rw-r--r--  1 iggy  iggy  98566144 Sep 12 16:39 MyDatabaseBackup.dat
mylaptop:Documents iggy$

You can see from the ‘ls’ file listing that our big file is 98566144 bytes long, or 94MB.

3. Now we will use the ‘split’ command to create our smaller files of (no more than) 10MB each. We will also have the smaller files named with a prefix of “MDB-“:

mylaptop:Documents iggy$ split -b 10m MyDatabaseBackup.dat MDB-
mylaptop:Documents iggy$ ls -la MDB-*
-rw-r--r--  1 iggy  iggy  10485760 Sep 12 16:46 MDB-aa
-rw-r--r--  1 iggy  iggy  10485760 Sep 12 16:46 MDB-ab
-rw-r--r--  1 iggy  iggy  10485760 Sep 12 16:46 MDB-ac
-rw-r--r--  1 iggy  iggy  10485760 Sep 12 16:46 MDB-ad
-rw-r--r--  1 iggy  iggy  10485760 Sep 12 16:46 MDB-ae
-rw-r--r--  1 iggy  iggy  10485760 Sep 12 16:46 MDB-af
-rw-r--r--  1 iggy  iggy  10485760 Sep 12 16:46 MDB-ag
-rw-r--r--  1 iggy  iggy  10485760 Sep 12 16:46 MDB-ah
-rw-r--r--  1 iggy  iggy  10485760 Sep 12 16:46 MDB-ai
-rw-r--r--  1 iggy  iggy   4194304 Sep 12 16:46 MDB-aj
mylaptop:Documents iggy$

From the file listing, you can see that we now have 9 files of 10MB each, and 1 file of 4MB. This is how ‘split’ works — it starts from the beginning of the big file, pulling out sequential 10MB chunks, until it gets to the end, where it will usually have a chunk smaller than 10MB.

4. At this point, we would usually transfer (or email) the smaller files to their destination. At the destination, we will simply use the ‘cat’ command to recombine the files back into a single file.

destination:Downloads $ cat MDB-* > DBBackup.dat

P.S. By the way, these instructions are applicable to Mac OS X, Jaguar, Panther, Tiger, Leopard, Linux, Unix, HP-UX, FreeBSD, etc.