I went searching the other night for a program that will split a large file into smaller chunks so that it can be downloaded in pieces and reconstructed. I don’t need this type of program very often these days, what with my cable modem, ZIP drive, and CD-R/CD-RW. Trafficking in 20 megabyte files today is a whole lot easier than 1 megabyte files were 10 years ago. But 9 gigabyte files are still a problem.
My first stop was WinFiles.com, where I searched for “file split” and came up with this page of hits. I can’t say that I looked at all of them, but the half dozen I looked at couldn’t handle splitting a 9 gigabyte file into gigabyte-sized chunks. Most failed when they tried to read the file size, because 9 gigabytes overflows a long integer (2 gigabytes signed, or 4 gigabytes unsigned). Others failed because they tried to allocate a 1 gigabyte file I/O buffer and overflowed my virtual memory.
If you want something done right…
Today I completed my Splitter program, which should work for any file up to 9,223,372,036,854,775,808 bytes in size. Of course, I don’t have a file that large with which to test the program, but I did split a 5-gigabyte file into 1-gigabyte chunks. The program lets you specify the chunk size and the output directory, and even creates a batch file that will reconstruct the file from the pieces.
The program isn’t terribly fancy, but it gets the job done. I wrote it more for the exercise than anything else. As with other Delphi projects, it was a pleasure to have the UI code essentially written so that I could concentrate on the actual processing. You can get the Delphi source here.