I haven't written the code yet. I'm still designing it in my head. Before I devote too much time to one design, I'm looking for comments.
I'll be breaking apart very large files into smaller, more manageable chunks. Later, I'll need to concatenate the chunks back together. The source files will be tens of gigabytes, which can choke some applications. I wanted to break them into something like 500 MB chunks.
I know there are applications out there that can do this (7zip and Winzip easily make "volumes" -- their word for chunks). But I'm neverthess going to write my own for a bunch of reasons that aren't relevant to the discussion. I want to do some processing on the chunks and have more programmatic control over the process.
I realize Windows Command Line can concatenate text files. I'm working with binary files, not text. Part of me is reluctant to use ordinary concatenation because if one errant $CR or $LF gets stuck in there, it ruins a 30 GB file.
So, here's where I'm heading...
My only concern is the GET$ and PUT$ commands and the strings they use. Like I said, these chunks could be 500 MB in size. Will PowerBasic choke on a string that size? I understand that string sizes in PB are essentially limitless. But certainly, they weren't exactly designed to hold 500 MB. If used inside a tight loop, do I risk over-consuming disk or memory resources? Is there another way to do this that I should consider?
I'll be breaking apart very large files into smaller, more manageable chunks. Later, I'll need to concatenate the chunks back together. The source files will be tens of gigabytes, which can choke some applications. I wanted to break them into something like 500 MB chunks.
I know there are applications out there that can do this (7zip and Winzip easily make "volumes" -- their word for chunks). But I'm neverthess going to write my own for a bunch of reasons that aren't relevant to the discussion. I want to do some processing on the chunks and have more programmatic control over the process.
I realize Windows Command Line can concatenate text files. I'm working with binary files, not text. Part of me is reluctant to use ordinary concatenation because if one errant $CR or $LF gets stuck in there, it ruins a 30 GB file.
So, here's where I'm heading...
Code:
LOCAL chunkstring as STRING OPEN "Recovered File.bin" FOR BINARY AS #1 ' this file will become a rebuilt concatenation of chunks FOR n=1 to 50 OPEN "chunk" + DEC$(n) + ".bin" FOR BINARY AS #2 ' open the next chunk GET$ #2, LOF(#2), chunkstring ' copy the entire file to a local string variable CLOSE #2 PUT$ #1, chunk ' accumulate the chunks NEXT n CLOSE #1
Comment