Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to split a File into pieces?

2,569 views
Skip to first unread message

linrx

unread,
Aug 8, 2001, 8:30:23 PM8/8/01
to
Well, actually I have two questions here.
First, is there any DOS command that allows me to split a big file into
many parts of the same size (say 1,000,000 bytes). 'COs I've discovered
recently that there's this command "copy /b file1+file2+file3 file" thingy
which allows me to merge files... So prior to this, how do I split a big
file into these various small pieces?

Second, is there any better way to simulate this while programming in
Visual Basic?

Appreciate your reply! Thanks a lot!

--
Posted via CNET Help.com
http://www.help.com/

anon...@bogus_address.con

unread,
Aug 9, 2001, 2:48:35 AM8/9/01
to

On 2001-08-09 li...@yahoo.com said:

>Well, actually I have two questions here.
>First, is there any DOS command that allows me to split a big file
>into many parts of the same size (say 1,000,000 bytes). 'COs I've
>discovered recently that there's this command "copy /b
>file1+file2+file3 file" thingy which allows me to merge files... So
>prior to this, how do I split a big file into these various small
>pieces?

You can't. Once the files are concantenated, that's pretty
much it. But I assume that you still have the =original=
files which you initially concantenated. There's your answer.

To split a =text= file, you can use many text editors or word
processors to mark a portion of the text, and copy it to
another file. Personally, I like PC-WRITE under DOS.

For binary files, it's not possible to split them up into
=usable= sections. But if you simply want to fit one huge
file onto multiple floppy disks, there are various third-
party utilities to do that.

If you aren't familiar with SIMTEL.NET, get familiar with
it. It's a huge on-line, downloadable collection of DOS
freeware/shareware. That's going to be your primary source
for these kinds of third-party utilities.

>Second, is there any better way to simulate this while programming
>in Visual Basic?

Simulate =what?= Splitting files? Concatenating files?
Either way, the answer is: probably not in a usable way.

>Appreciate your reply! Thanks a lot!

Y'all come back, now...y'heah? :)

Phil Robyn

unread,
Aug 9, 2001, 3:35:16 AM8/9/01
to
linrx wrote:

There are some old DOS command-line PROGRAMS (e.g., SLICE and
SPLICE from PC-Magazine come to mind) to chop up and reassemble
large files. If you look around, you will find LOTS of programs to do
this. Why not just use WinZip or PKZIP?

To do this in (some kind of) BASIC, you basically read the input file a
byte a time and write each output file a byte at a time, incrementing the
bytes written counter, until the count of bytes written is equal to the desired
number of bytes, then close that slice file, reset the bytes written counter
to zero, open the next slice file and write a byte from the input file until the
count of bytes written is equal to the desired number; keep doing this until
you encounter EOF on the input file, then close all files and exit. The output
files are declared with a record length of one.

Here's an example QBASIC (that's the interpreter, not QuickBasic) program
that splits a large file into multiple files by records (or lines):

==========begin file c:\QBASPGMS\SPLIT04.BAS ==========
001. DIM Inrec AS STRING
002. DIM Infile AS STRING
003. DIM OutFile AS STRING
004. DIM MsgFile AS STRING
005. DIM OutFname AS STRING
006. DIM FileSeq AS STRING
007. DIM RecsInFile AS LONG
008. DIM i AS LONG
009. DIM ctr AS INTEGER
010.
011. Infile = ENVIRON$("INFILE")
012. OutFile = ENVIRON$("OUTFILE")
013. MsgFile = ENVIRON$("MSGFILE")
014. RecsInFile = VAL(ENVIRON$("RECS_PER_FILE"))
015. ctr = 1
016.
017. OPEN Infile FOR INPUT AS #1
018. OPEN MsgFile FOR OUTPUT AS #3
019. DO
020. FileSeq = "000" + MID$(STR$(ctr), 2)
021. FileSeq = "." + RIGHT$(FileSeq, 3)
022. OutFname = OutFile + FileSeq
023. OPEN OutFname FOR OUTPUT AS #2
024. ON ERROR GOTO NOFILE
025. FOR i = 1 TO RecsInFile
026. LINE INPUT #1, Inrec
027. PRINT #2, Inrec
028. NEXT i
029. NOFILE:
030. CLOSE #2
031. PRINT #3, "Created file ", OutFname
032. ctr = ctr + 1
033. LOOP UNTIL (EOF(1))
034.
035. CLOSE
036. SYSTEM
==========end file c:\QBASPGMS\SPLIT04.BAS ==========


--
Phil Robyn
Univ. of California, Berkeley

u n z i p m y a d d r e s s t o s e n d e - m a i l


JimB

unread,
Aug 9, 2001, 6:08:29 AM8/9/01
to
linrx wrote:
>
> Well, actually I have two questions here.
> First, is there any DOS command that allows me to split a big file into
> many parts of the same size (say 1,000,000 bytes). 'COs I've discovered
> recently that there's this command "copy /b file1+file2+file3 file" thingy
> which allows me to merge files... So prior to this, how do I split a big
> file into these various small pieces?
>

I regularly use a pair of freeware DOS commands to do this. Look for
CHOP595 on shareware sites. If you can't find a copy I'll email them -
the files are not big.

--
Jim

Timo Salmi

unread,
Aug 9, 2001, 6:14:31 AM8/9/01
to
In article <tn3mcva...@corp.supernews.com>, linrx <li...@yahoo.com> wrote:
> First, is there any DOS command that allows me to split a big file into
> many parts of the same size (say 1,000,000 bytes). 'COs I've discovered

ftp://garbo.uwasa.fi/pc/ts/tsutlc25.zip Third set of Utilities, T.Salmi
Filename Comment Date Time
-------- -------------------------------- ---- ----
DIRF.EXE Directory in full, recursive Mar-03-2000 09:40:48
DIRINFO.EXE Directory information of a disk Feb-29-2000 02:49:10
DOUBLES.EXE Find double file names on a disk Mar-03-2000 20:46:40
DTEDIF.EXE Difference between two dates Mar-01-2000 03:12:08
FILE_ID.DIZ Brief characterization of TSUTLC Feb-29-2000 02:38:24
HIDDEN.EXE Find all hidden files on disk(s) Mar-04-2000 07:32:48
READONLY.EXE Find all readonly files on disks Mar-04-2000 07:58:02
SPLIT.EXE Split a file into pieces Mar-01-2000 03:16:46 <----
SYSFILES.EXE Find all system files on disk(s) Mar-04-2000 08:56:56
TSPROG.INF List of programs from Timo Salmi Jan-20-2000 12:21:36
TSUTLC.INF Document (a readme) Mar-04-2000 09:15:20
TSUTLC.NWS News announcements about tsutlc Mar-04-2000 09:15:58
VAASA.INF Info: Finland, Vaasa, U of Vaasa Oct-18-1997 13:18:46
WHATDATE.EXE Date +- number of days from now Mar-01-2000 03:19:46
ZEROFILE.EXE Find all empty files on disk(s) Mar-04-2000 09:08:50
---- ------ ------ -----
0015 205731

All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/> ; FIN-65101, Finland
Timo's FAQ materials at http://www.uwasa.fi/~ts/http/tsfaq.html

arn...@netcava.net

unread,
Aug 9, 2001, 9:00:52 AM8/9/01
to

On 2001-08-09 li...@yahoo.com said:
>Newsgroups: comp.os.msdos.misc


>Well, actually I have two questions here.
>First, is there any DOS command that allows me to split a big file
>into many parts of the same size (say 1,000,000 bytes). 'COs I've
>discovered recently that there's this command "copy /b
>file1+file2+file3 file" thingy which allows me to merge files... So
>prior to this, how do I split a big file into these various small
>pieces?

there's nothing in pure DOS to do this,
but you may use 3rd party software, there are
many.

I generally use the Rar compression utility to do this
which is available from www.rarsoft.com

>Second, is there any better way to simulate this while programming
>in Visual Basic?

I suspect you would have to use a 3rd party library
to do this, or program one yourself...

Arnaud de Bonald <arn...@netcava.nnet>
Netcava - a new free french BBS - http://www.netcava.net

Net-Tamer V 1.13 Beta - Test Drive

Bundy

unread,
Aug 9, 2001, 9:50:49 PM8/9/01
to
I personally would use PKWARE but if all you want to do it to split a file
may I suggest "SPLIT" at http://www.sharewarejunkies.com/8s3/splitdos.htm
Its freeware. Its for DOS/Win31/win9x

Don

Type of Program: File Utility
Supported Platforms: DOS, Win 3.x, Win 95
Author/Company Name: Syed Nasir Alsagoff/Snake Soft Inc.
Version: 1.0
Price: Freeware
Installed Size: 32.2 K

Here is a program designed to perform only one task, but it performs really
at its best, swiftly, and on almost every PC. Split, as its name suggest, is
a file splitter. It is designed to work on every machine, from the old 286
to the Pentium-based PC (DOS 3.3 is enough to let it work). It asks for
minimum space and memory to split large files in pieces fitting floppy
disks. One can decide if splitting files by number of partitions (i.e.
floppy disks) or by partition size (Split will tell you how many disks are
required, then). The program is able, also, to check for identical files
already existent (avoiding overwriting), if the partition size will fit the
floppy disk's space, to verify file during splitting to avoid errors. You
don't even need the program, to rejoin the file pieces. In fact, when
splitting, Split creates a batch file that, once launched will provide to
rejoin the pieces, checking if the target location is valid, if there are
already files with the same name and so on. The files I splitted and
rejoined had no error and worked finely. In few words, a program highly
recommendable. Oh, I was missing the last feature. The program is free, if
you like it let the author know, sending him an e-mail. It's the only effort
he asks you for.


"linrx" <li...@yahoo.com> wrote in message
news:tn3mcva...@corp.supernews.com...

Marco van de Voort

unread,
Aug 19, 2001, 8:58:17 PM8/19/01
to
In article <tn7ps62...@corp.supernews.com>, Bundy wrote:
> I personally would use PKWARE but if all you want to do it to split a file
> may I suggest "SPLIT" at http://www.sharewarejunkies.com/8s3/splitdos.htm
> Its freeware. Its for DOS/Win31/win9x

There are Unix versions with the same name (but are afaik different
sourcebase)

FreeBSD has one in it's default distribution:

</home/marcov> split -?
usage: split [-b byte_count] [-l line_count] [-p pattern] [file [prefix]]

Marco van de Voort

unread,
Aug 19, 2001, 9:04:02 PM8/19/01
to
In article <tn7ps62...@corp.supernews.com>, Bundy wrote:
> I personally would use PKWARE but if all you want to do it to split a file
> may I suggest "SPLIT" at http://www.sharewarejunkies.com/8s3/splitdos.htm
> Its freeware. Its for DOS/Win31/win9x

There are Unix versions with the same name (but are afaik different

Theodore Heise

unread,
Aug 30, 2001, 8:44:21 AM8/30/01
to
On 9 Aug 2001 13:00:52 GMT,
arn...@netcava.net <arn...@netcava.net> wrote:

>
>
> On 2001-08-09 li...@yahoo.com said:
> >First, is there any DOS command that allows me to split a big file
> >into many parts of the same size (say 1,000,000 bytes).
>
> there's nothing in pure DOS to do this,

Well, it's not exactly what is asked for, but if a floppy disk capacity
is a suitable size one could use the backup command to split a big file
into disk-sized pieces.

Ted

--
Theodore W. Heise <the...@netins.net> West Lafayette, IN, USA

arn...@netcava.net

unread,
Sep 1, 2001, 10:02:25 AM9/1/01
to

On 2001-08-30 the...@netins.net(TheodoreHeise) said:
>Well, it's not exactly what is asked for, but if a floppy disk
>capacity is a suitable size one could use the backup command to
>split a big file into disk-sized pieces.

oh no, avoid the Backup command!

it's not flexible at all, and it's dependent on the specific DOS version you
use, because the backup command used on each version of MSDOS was not
compatible with each other.

one advice, Forget it!

Jim Van Nuland

unread,
Sep 2, 2001, 3:51:34 AM9/2/01
to
:> On 2001-08-09 li...@yahoo.com said:
:> >First, is there any DOS command that allows me to split a big file
:> >into many parts of the same size (say 1,000,000 bytes).

The PKZIP program can be told to span disks. It will put as much as it
can on each disk, or can be told to erase whatever is there first.

When PKUNZIPing, it will ask for the last disk, then the first one,
second, etc...

--
-- Jim Van Nuland, San Jose (California) Astronomical Association
http://www.svpal.org/~jvn/ JVN's home page

Nogfx

unread,
Sep 2, 2001, 7:08:52 AM9/2/01
to
linrx <li...@yahoo.com> wrote in message news:<tn3mcva...@corp.supernews.com>...

> Well, actually I have two questions here.

> First, is there any DOS command that allows me to split a big file into

> many parts of the same size (say 1,000,000 bytes). 'COs I've discovered

> recently that there's this command "copy /b file1+file2+file3 file" thingy

> which allows me to merge files... So prior to this, how do I split a big

> file into these various small pieces?

>
You can use Chunker which comes with a second tool dechunk that will merge
the files.

ex: let's say you got a file: MyProg.Dat 3 256 428 bytes
you just have to type: chunker MyProg.Dat MyProg 720000
=> It will split your file into 720 000 bytes files named:
MyProg.000 720 000
MyProg.001 720 000
...

Then you will be able to merge the files again with the command:
dechunk MyProg.dat MyProg

This tool can be usefull to transfer files between different computers because
it comes with c sources and exes for PC/DOS, Unix and AmigaOS...


It can be downloaded on every Aminet site, for example:
http://ftp.uni-paderborn.de/aminet/

Regards,
Nogfx.

arn...@netcava.net

unread,
Sep 2, 2001, 8:34:58 AM9/2/01
to
You're right, nowever I think ARJ or RAR
offer more flexibility for multi-volume archives extraction.

You can even start from disk 3 or any disk, it will issue a warning
but this will work.


On 2001-09-02 j...@svpal.org said:
>Newsgroups: comp.os.msdos.misc

Arnaud de Bonald <arn...@netcava.nnet>

0 new messages