How do I split a big file into smaller ones (more FTP friendly), and merge them back later?
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开发者_如何学Go about how to program this myself... or even use a utility.
** Windows platform **
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.
On windows you can easyly split it with WinRar.
Or you do it "with your own hand":
1) 1
2) 2
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.
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.
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
精彩评论