tags:

views:

409

answers:

5

My server doesnt allow upload/download of big files. On the other hand, I built a bootstrapper that needs to upload/download big files. How can I split a big file into smaller subfiles.. and do the merging later on? An already done c# library would be great... but I'm happy hear suggestions about how to program this myself... or even use a utility.

** Windows platform **

+2  A: 

On Unix, you can use the split command to break apart the file, and then use cat to concatenate them together.

split -b 1024M bigfile.tar.gz bigfile

This will create oodles of files like bigfileaa bigfileab, etc. So then ftp all the little beasties to the destination and do the cat:

cat bigfile* > bigfile.tar.gz

On Windows, you might have an option in your Zip application to break apart an archive and remerge it on the other end. Actually, a googling of the search terms: zip split turns up several such options.

+2  A: 

On windows you can easyly split it with WinRar.

Or you do it "with your own hand":

1) 1

2) 2

Kovu
Or 7zip, which is free.
Ryan Emerle
+1 - The link #1 worked really well.
John M
A: 

You can make a split and join program with a handful of lines each. Just read some fixed amount (512KB, 4MB, whatever) from a file and write it out to a new file. Repeat this (and change the filename you write to) until you reach the end of the file.

Another program needs to read from these files and write their contents (one after another) to a target file.

Pretty easy, really, and if you want to get some programming experience it would be a good exercise.

Artelius
The OP is overthinking this one. Either use the split and merge capability of your archive utililty (zip, whatever) or write the 4 lines each to split and cat the files. The Unix cat utility writes to standard out, saving even opening the output file.
+2  A: 

Every zip program I've ever used has this ability.

7zip is my current favorite on windows. It has a nice command line version, too.

Michael Haren
what is the command line using 7zip?
Nestor
Here are a bunch of examples http://dotnetperls.com/7-zip-examples
Michael Haren
A: 

Or, you can write a small application to meet your needs... Just bytes read and then write....So, it can eazily split the big file into small ones

Macroideal
And, when you wanto merge it, you can use the same rules,,read the files individually and then write into one file
Macroideal