[lug] splitting a binary file

Tkil tkil at scrye.com
Fri Aug 31 11:46:04 MDT 2001


>>>>> "q" == qqq1one  <qqq1one at yahoo.com> writes:

q> Does anyone know how to split a binary file into smaller pieces so
q> that it can be emailed and then reconstructed at the other end? 
q> I've looked at tar, zip, bzip2, gzip, and cpio, but I don't see an
q> option for specifying the maximum size of each part when breaking
q> the file into multiple parts.

just for splitting, you want to use the unix swiss army knife, 'dd':

   for i in 0 1 2 3 4 5
   do
     dd if=bigfile of=chunk$i bs=1M count=1 skip=$i
   done

helpful hint:  if you need to move a large file to a windows box on
floppy, you can split it up on the unix side using similar commands,
then use something like this on the dos side:

   copy chunk0+chunk1+chunk2+chunk3 bigfile

to reconstruct it.

if you're doing this for mailing, look at the "metasend" utility from
the "metamail" package.  it will split for you (-S) and add the
appropriate MIME multipart(?) headers, using "splitmail" as a back
end.  the metamail package is generally very handy for dealing with
MIME mail from the command line.

t.



More information about the LUG mailing list