/usr/bin/split
and /bin/cat
, that is. Why is this useful information? Let’s imagine a wonderful world in which your web host gives you oodles of bandwidth and disk quota, and then one day secretly enacts a policy that disallows access to files over a certain (largish) size. Say, something like:
[Tue Jan 02 13:07:24 2007] [error] [client x.x.x.42] (75)Value too large for defined data type: access to /some/big/file.omg failed
Let’s also suppose that this file is indeed really big, and you totally don’t want to go through the pain of segmenting it locally and then uploading it again. If the server and client(s) are unixy, here is your salvation:
split -b 500m BigFile BigFileParts_
This will segment your file into chunks that are 500 MB in size (though obviously the last one will probably be less). You will end up with files named BigFileParts_aa, BigFileParts_ab, and so on. Now you can download them, presuming 500 MB is beneath the threshold of the policy which blocks big file xfers; adjust accordingly.
Once downloaded, put them back together with cat, appending from the back to the front:
cat BigFileParts_ac >> BigFileParts_ab
cat BigFileParts_ab >> BigFileParts_aa
mv BigFileParts_aa BigFile