How do I split a big file into smaller ones (more FTP friendly), and merge them back later?

StackOverflow https://stackoverflow.com/questions/1659016

  •  11-09-2019
  •  | 
  •  

Question

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 **

Was it helpful?

Solution

On windows you can easyly split it with WinRar.

Or you do it "with your own hand":

1) 1

2) 2

OTHER TIPS

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.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top