thefekete.net

$> :(){ :|:& };:

Splitting large files for a FAT32 removable drive or flash drive

If you got a file or group of files to put on a removable drive with a FAT32 file system – and any of them are over 4GB – then you need a way to make it smaller for transport. The easiest way is with split, cat and tar.

One file

For the simplest case of a single file, you can just split it:


#!/bin/bash
split --numeric-suffixes --bytes=4GB SRCFILE SRCFILE.split

I like to use –numeric-suffixes so that the files end up like SRCFILE.split00, SRCFILE.split01, etc.

When you’re ready to extract on the other end:


#!/bin/bash
cat SRCFILE.split* > SRCFILE

Multiple files

If you’ve got more than one file, you can do the following:


#!/bin/bash
tar -cvf - SRCDIR | split --numeric-suffixes --bytes=4GB - SRCDIR.tar.split
# You can also compress it, put a z in the tar command
tar -czvf - SRCDIR | split --numeric-suffixes --bytes=4GB - SRCDIR.tar.gz.split

Then to extract the files:


#!/bin/bash
cat SRCDIR.tar.split* | tar -xvf -
# Or for the compressed one, put a z in the tar command
cat SRCDIR.tar.split* | tar -xzvf -

Leave a Reply

HTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting