Dec 242017
No copy empty file over full one!.
File ZCOPY.ZIP from The Programmer’s Corner in
Category File Managers
No copy empty file over full one!.
File Name File Size Zip Size Zip Type
ZCOPY.DOC 3865 1578 deflated
ZCOPY.EXE 34313 24577 deflated

Download File ZCOPY.ZIP Here

Contents of the ZCOPY.DOC file


Copyright 1988, Life Sciences Editorial Service
Annapolis, Maryland 21401

This program may be freely copied and distributed,
but it may not be sold.

Purpose: The DOS command COPY can be dangerous when you are
copying in batch mode with "wildcard" file names and one
or more of the files being copied has no data; the zero-
length files can replace files with the same names that
do contain data you want to keep. I'm sure I'm not the
first to discover this, but unfortunately I learned it
the hard way. I was "updating" files on one disk by
copying a batch of identically named files from another
disk. The command I used while in a directory on drive C
was simply this:


Drive B had a number of files with the extension .SBA and
drive C had a set of files with the same names. The
difference was that the files on drive B, created with
another computer, were more recent and not all of them were
filled with data, whereas all the .SBA files on drive C were
filled with data. Although I expected to update only the
changed files, what happened was that some files on drive
C were updated while other drive C files were replaced with
empty ones from drive B. This made me scowl, because the data
was lost forever.

Oddly, the COPY function never seems willing to copy a
file with zero length if the name of the file is fully
specified on the command line. It seems that only in batch
mode, with wildcards, can replacement of valuable data-filled
files with empty ones occur. Even more bizarre, it occurs
sporadically, at least on my computer. Even so, once is

ZCOPY.EXE is the remedial program I wrote after my painful
discovery. It determines the size of a file before it lets the
DOS COPY command (via a shell) do anything with it. If the file
length is zero, it simply refuses to let it be copied, tells you
so, and goes on to check the next file.

RAM: About 35k

Command: Since all copying is still done by the DOS COPY function, the
program command line is almost identical to the one for DOS COPY.
The only difference is that you type ZCOPY instead of COPY:

ZCOPY [Source Drv\Dir\file] [Destination Drv\Dir\file]

All the rules for using the DOS COPY function still apply. ZCOPY
just screens things a bit before letting COPY do its job. It also
tells you exactly where files are going and whether they will be
copied at all: no length, no copying -- and no grief. Although
disk I/O functions are all handled DOS COPY, file measuring is
done by assembly language modules linked to the program, which
is written in Microsoft QuickBASIC 4.0.

Demonstration files:

A set of short practice files, some with zero length, is
included in this package to give you an idea of how the
program works. They all have the extension .TST. You
can put them on a disk in drive B and copy them to drive A,
for example, using this command:


And finally, the standard disclaimer:

The author is not responsible for any loss or damage caused
by this program; use it at your own risk.

Pete Petrakis 76555,1175

 December 24, 2017  Add comments

Leave a Reply