'=========================================================================== ' Subject: SPLIT/CONCATENATE FILE Date: 11-29-96 (09:43) ' Author: Kurt Kuzba Code: QB, QBasic, PDS ' Origin: FidoNet QUIK_BAS Echo Packet: FAQS.ABC '=========================================================================== 'I recently had a use for a program to split files apart and 'restore them to the original again afterwards, hence these two 'programs. You might include a real menu and put them into a 'single program with all sorts of bells and whistles, but I 'didn't take the time to since they served my needs as is. 'If anybody has questions or suggestions, feel free. :) 'First, to take the files apart into manageable segments: '_|_|_| SPLITTER.BAS '_|_|_| Splits a file into 1MB segments. '_|_|_| No warrantee or guarantee given or implied. '_|_|_| Released PUBLIC DOMAIN by Kurt Kuzba. (11/29/96) ON ERROR GOTO OOps CLOSE INPUT "enter name of file to split => ", NFile$ PRINT "enter name of file sections" INPUT "(EX. game > 'gamex.tmp') => ", NTemp$ NoSeg% = 0: Source% = FREEFILE OPEN NFile$ FOR BINARY AS #Source% Destination% = FREEFILE WHILE NOT EOF(Source%) F$ = NTemp$ + LTRIM$(STR$(NoSeg%)) + ".tmp" OPEN F$ FOR OUTPUT AS #Destination% accum& = 0 WHILE (NOT EOF(Source%)) AND (accum& < 1048576) dat$ = INPUT$(1024, Source%): ln& = LEN(dat$) accum& = accum& + ln&: PRINT #Destination%, dat$; WEND CLOSE Destination%: NoSeg% = NoSeg% + 1 WEND: CLOSE Source%: END OOps: CLOSE : PRINT ERR: END '_|_|_| end SPLITTER.BAS 'And then, to restore the original file from the segments: '_|_|_| CONCAT.BAS '_|_|_| Restores files split using SPLITTER.BAS to one file. '_|_|_| No warrantee or guarantee given or implied. '_|_|_| Released PUBLIC DOMAIN by Kurt Kuzba. (11/29/96) ON ERROR GOTO OOps INPUT "Files to concatenate => ", Pieces$ INPUT "Name of output file => ", Whole$ W% = FREEFILE: OPEN Whole$ FOR OUTPUT AS #W% IF BooBoo% <> 0 THEN CLOSE : END P% = FREEFILE: Part% = 0 DO F$ = Pieces$ + LTRIM$(STR$(Part%)) + ".tmp" OPEN F$ FOR INPUT AS #P% IF BooBoo% <> 0 THEN CLOSE : END: ELSE CLOSE P% OPEN F$ FOR BINARY AS #P% WHILE NOT EOF(P%) dat$ = INPUT$(1024, P%): PRINT #W%, dat$; WEND CLOSE P%: Part% = Part% + 1 LOOP: END OOps: BooBoo% = ERR: RESUME NEXT '_|_|_| end CONCAT.BAS