home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
SPFL11.ZIP
/
SPLFL11.TXT
< prev
next >
Wrap
Text File
|
1990-12-21
|
15KB
|
297 lines
***SPLIT-FILE ***
Version 1.10
Surprisingly, with all the shareware programs in the world, I
was never able to find a file-splitting utility with the
flexibility and ease of use I wanted. My only solution was to
write my own. This program, "SPLIT-FILE" is the result. It is a
DUAL-MODE program that works just as well under DOS as it does
under protected mode OS/2. No other file splitting utility I've
found can do that!
Because I wrote this program primarily for myself, I am
releasing it into the public domain as a favor to others, without
any requests for remuneration. So, use it and enjoy it without
guilt! I would however like to hear from anyone who may have
problems with it so I may correct them in future versions.
The source code for this program is also free via diskette to
anyone who wants it but because of the costs of diskette media and
mailing, I must ask that $4.00 accompany any request. Mail your
request to:
Don Perry
P.O. Box 835
Pleasanton, CA 94566-0083
(415) 462-0798
PROGRAM OVERVIEW
There are many reasons to split large files but the two main
ones I've found are to (1) allow transferring to removeable media
(floppy disks) for transporting or archival purposes or (2) to
split large text files for easier manipulation by word processors,
text editors or other programs. SPLIT-FILE makes both types easy
by operating differently depending whether the destination of the
split files is going to removable (floppy) or fixed (hard disk)
media. It assumes that when writing to floppy you want to cram as
much of the file as possible on each floppy and defaults to that
end (although you can specify a specific reserve amount be left on
each one with one of the options.) When writing to fixed media (a
hard disk) it simply splits the source file(s) into as many files
as necessary to a default size of 50,000 bytes or the size chosen
in the option switch /s:?.
SPLIT-FILE has a myriad of options. For instance, when
writing to floppies, you have the option of clearing the entire
target floppy before writing, determining a reserve amount of space
to be left on the diskette and to change the volume label on the
target to either a name of your choosing or automatically to the
filename sequence of the file you are splitting. You can also
choose the level of erasure verification of the target media. A
new option has been added with version 1.1 to specify that the
target diskettes or files only be split at the end of a line when
splitting text files.
SPLIT-FILE will also accept more than one source file for
splitting at a time. It will either combine these multiple files
in the order you specify into one 'split set' or create a new set
for each new source file as a time saving feature rather than run
the program multiple times.
PROGRAM OPERATION
SPLIT-FILE's operation is controlled solely from the command
line via command line switches. This makes it possible to simplify
its operation by creating reusable batch files for splitting
different types of files. (Examples are given later).
The command line switches are as follows:
Switch Description Default
------ ----------- -------
/d:?: ?=Target drive designation A:
/t:? ?=Target filename source filename
/n New file for each source NO
/c Clear target drive first NO
/v:? ?=New Volume label text unchanged
/r:? ?=Reserve amount on target disk 0 bytes
/x Skip target erase verification NO
/b Split files at line endings only NO
/s:? ?=Size of target hard disk files 50,000 bytes
/d:? DRIVE - Selects the target drive for the target file
fragments. If none is specified, the drive is assumed to be
A:. The program automatically determines whether your choice
is a floppy or a hard disk. It is important to remember the
colon before and after your drive letter choice.
/t:? TARGET FILENAME - Specifies the name to use for the fragment
files. You can only choose the filename, not the extension as
the extension will be determined automatically by the program
to be numbers from .001 to .999 depending on the number of
fragment files it has to create. If a target filename is not
specified, it defaults to the name of the first specified
source file.
/n NEW SET EACH FILE - Specifies that you want SPLIT-FILE to
create a new set of file fragments for each source file
specified. If you specify only one source file, this option
has no effect.
/c CLEAR TARGET DRIVE - When the target drive is a floppy, this
switch specifies that you want it erased completely including
any sub-directories before the writing of the file fragments .
As a precaution however, it will not erase any read-only
files. This option will not work on a hard drive destination.
/v:? VOLUME NAME - Specifies the name to use on the target floppy
up to 11 characters. The name will be converted into upper
case. The name can include spaces but if it does, make sure
it is enclosed in quotes as in "MY DISK". As an alternative,
if you specify a plus sign (/v:+), SPLIT-FILE will name the
volume the same as the target filespec for that floppy. Also
if you specify a minus sign (/v:-), the volume name on the
target will be removed completely. This option has no effect
on hard drive destinations.
/r: RESERVE AMOUNT - Specifies the amount of space to leave on the
floppy destination drive from 0 to 65535 bytes. This space
will be left on each floppy for the set. It is useful if you
want to add other information or edit the file fragments
between themselves later. This option has no effect on hard
drive destinations.
/x NO ERASE VERIFICATION - This option eliminates the prompting of
whether or not you want to erase the target floppy drive when
used with the /c option. Its use makes file splitting faster
but is more dangerous. This option has no effect on hard
drive destinations.
/b SPLIT AT LINE ENDINGS - This forces files to be split at line
endings only. With the /b option specified, files will be
split at the last Carriage Return that can be found before the
maximum size of the target disk (or file if splitting to a
hard disk) is reached. When splitting to diskettes, because
it splits at line endings only, a little unused space is left
on each target disk. And when spltting to hard disks, the /b
option results in target files of slightly different sizes for
the same reason. This options should only be used for text
files. It is useless with binary files.
/s: SIZE OF DESTINATION FILES - Specifies the actual size of the
target hard disk files. This number can be any size. If the
/s: option is not used, the default hard disk file size is
50,000 bytes. This option is operational only with hard drive
destinations.
EXAMPLE USES:
1> You want to split a 2,000,000 byte hard disk file onto
360K floppies. The target drive B: is a regular 360K floppy. The
source filename is BIGFILE.TXT and it is in the current directory
of your hard disk. You want the volume labels of the target
floppies to be named IM GEORGE. You want to clear the target
floppies before writing and you do not want any reserve bytes on
the floppies. The syntax would be:
splitfile bigfile.txt /d:b: /v:"im george" /c
This would result in the creation of 6 floppy diskettes, on each
diskette, a single file would be created named bigfile.001 on
diskette #1, bigfile.002 on diskette #2 etc. The volume label on
each diskette would be changed to IM GEORGE. The first 5 diskettes
would be filled to capacity (about 362496 bytes) and the 6th would
fill up to the remainder (about 187520 bytes).
2> You have two files named MYFILE1.DOC which is 400,000
bytes and MYFILE2.DOC which is 600,000 bytes in the current
directory of your hard drive. You want to combine and then split
them into 360k floppies on drive B: as in example #1 above but now
you also want to change the volume name of the diskettes to the
same as the target files and to leave 8192 bytes on each target
diskette for later editing.
The syntax would be:
spltfile myfile1.txt myfile2.txt /d:b: /v:+ /r:8192 /c
This would result in the creation of 3 diskettes, the first
diskette would have a single file named myfile1.001 (of about
354304 bytes) with 8192 bytes left and the volume name would be
MYFILE1_001. The second diskette would be the same except the
filename would be myfile1.002 and the volume label MYFILE1.002.
The third diskette would have a file named myfile1.003 (of about
291392 bytes) and a volume name of MYFILE1_003. Note that the file
myfile1.002 on the second diskette will be a combination of both
source files myfile1.txt and myfile2.txt being concatenated
together.
3> Same example as #2 above but you want myfile1.txt and
myfile2.txt to be two separate file fragment sets.
The syntax would be:
spltfile myfile1.txt myfile2.txt /d:b: /v:+ /r:8192 /c /n
Now, you would get a total of four diskettes, the first same as in
example #2 above but now the file on the second diskette
(myfile1.002) is now only 45696 bytes. The file on the third
diskette would be named myfile2.001 (instead of myfile1.003) and
the file on the forth named myfile2.002. There is now no combining
of the files. With the "/n" option chosen, it is effectively the
same as doing two separate file splits for both myfile1.txt and
myfile2.txt. It is just a way to save time.
4> There is a very large file named immense.txt which is
4,000,000 bytes long in the root directory of your hard drive C:
and you want to split it into files exactly 124,677 bytes each in
your current directory. (Spltfile.exe is there too or it is
identified in a directory named in your path environment variable.)
The syntax is:
spltfile \immense.txt /d:c: /s:124677
This will result in the creation of 33 files named immense.001 to
immense.033 respectively in your current directory. The first 32
will be exactly 124677 bytes long and the last will be 10336 bytes
long. Note that when a hard disk is the destination, SPLIT-FILE
always writes the file fragments into the current directory.
5> You have a large text file of 1,000,000 bytes called
lotoftxt.doc that you would like to split to your B: drive which is
a 360K floppy but you don't want the text at the separation points
of the split files to be broken between words or lines.
The syntax is:
splitfile lotoftxt.doc /d:b: /b
This will split lotoftxt.doc onto approximately three 360K floppies
each with a single file named lotoftxt.001 to lotoftxt.003. Each
of these files are separated at the end of a line. And because of
this end of line division, each diskette has a little of unused
space left, depending on the length of lines and the arbitrary
positioning of the carriage returns used in lotoftxt.doc.
FILE CONDENSING UTILITIES
SPLIT-FILE is not, nor does it claim to be a replacement for
file condensing / archiving utilities such as SEAWARE'S ARC.EXE
utility or PKWARE'S PKZIP.EXE utility. SPLIT-FILE simply splits
files unchanged into smaller ones. It is primarily for use on
ASCII text files but can be used effectively on ANY file including
large condensed archives themselves. For example, a large
condensed archive of data you want to send your co-worker is
424,676 bytes long. His (or her) computer has only 360K floppy
drives and a hard disk. Instead of taking apart your condensed
archive and creating two smaller ones, simply run SPLIT-FILE to
create two floppies as in example #1 above. Your co-worker can
copy these diskettes to his (or her) hard disk and put them back
together with the DOS or OS/2 copy command as:
copy bigfile.001 /b + bigfile.002 /b bigfile.zip
USE AS POOR MANS CD WORM*
SPLIT-FILE is really great for BBS users who save their BBS
sessions to log files. Over time, these files can grow quite large
and take up quite a bit of hard disk space. You don't want to
delete them though because there is a lot of information you
remember reading in them of value. The solution? Use SPLIT-FILE
to write these archives to floppies. With the volume option they
will be consecutively numbered and easy to keep in order. You can
then use a text list and/or search utility like Vern Buerg's LIST
or Peter Norton's TS (text search) program to thumb through these
floppies. If you have a HD 1.44 mb diskette, quite a bit of
information can be stored on them at one time. SPLIT-FILE is
better for this purpose than a backup or archive utility because
you need not reconstruct the files to the hard disk first to read
them.
* a CD WORM is a laser disk "Write Once Read Many" mass storage
device capable of storing many megabytes of information for random
retrieval. WORM disks are available for Dictionaries, Thesauruses,
etc.
CHANGES FROM VERSION 1.00 to 1.10
SPLIT-FILE now runs on the entire family of computers with
Intel processors from 8088 to 80486. The original 1.0 version only
worked with the 80286 and above.
File splitting at line ends has been added as an option for
text files so that the target diskettes or files are not cut off
exactly at their size limit (whether or not it happens to be in the
middle of a word or line) but instead are always split between
complete lines.
USE UNDER OS/2
This program was written as a dual mode program that runs
under OS/2 and DOS. If used under OS/2, it will run in it's own
window under the Presentation Manager interface and multiple
sessions of SPLIT-FILE can be run simultaneously. If you are using
OS/2 specifically, you may get an OS/2 specific version of this
program by sending $4.00 to:
Don Perry
P.O. Box 835
Pleasanton, CA 94566-0083
(415) 462-0798
CompuServe ID: 76676,1127
Please specify disk format (5.25 or 3.5) desired.