Copy

From BR Wiki
Jump to navigation Jump to search

The Copy (COP) command copies one or more files in numerous ways:

  1. From one directory to another on the same or different disks.
  2. From one place on a directory to another place on the same directory. In this case you must give the resultant copy a different name.
  3. From a file to a printer.
  4. The -S option has been added to allow copying of a file which is currently open. The file to be copied must be opened for sharing (Shr or ShrI). If it is opened NoShr, a file sharing violation error 4148 will occur when Copy with -S is attempted.

Comments and Examples

When using the copy command, you may specify a drive letter or number, and a path. You may also use wildcard characters ? and * in place of alphanumeric characters in file names. Redirection symbols > and >> redirect screen output to a printer, a file, or another device.

The following command copies the file SAMPLE from the default directory of a disk in drive A to the default directory of a disk in drive B. The file name remains the same:

COPY A:SAMPLE B:

The next command copies the file SAMPLE from the subdirectory \TEST1 on a disk in drive A to the subdirectory \TEST2 on the same disk. If TEST2 does not exist as a subdirectory, Business Rules names the file TEST2 and places it in the default directory on the default drive:

COPY A:\TEST1\SAMPLE A:\TEST2

The following command copies SAMPLE from one place in the subdirectory \TEST1 on a disk in drive A to another place in the same subdirectory. The copied file is renamed SAMPLE1:

COPY A:\TEST1\SAMPLE A:\TEST1\SAMPLE1

The next command copies the file SAMPLE from the default directory of a disk in drive B to a printer attached to the first parallel port:

COPY B:SAMPLE PRN:

The same file can be copied to the printer at the first serial port with the following command:

COPY B:SAMPLE AUX:

The next command copies all files with names starting with SAMPLE, a period and any extension from a disk in drive A to a disk in drive B. The D in the command causes deleted records to be removed from any of the SAMPLE files which are internal files. The C in the command causes Business Rules! to prompt for a diskette change if the disk in drive B fills up before the copying process is completed.

COPY A:SAMPLE.* B: -DC

The following example copies the internal file SAMPLE from a disk in drive A to a disk in drive B, setting the record length of the new file at 128:

COPY A:SAMPLE B: -128

Syntax

COPY <from file> {[AUX:]|[PRN:]|[<to file>]} {[>[>]<output file>]|[PRINT]} [<-option>]

Defaults

  1. Copy the file, using the current file name, into the current directory on the current drive.
  2. Display a log of all performed actions in the command console.

Parameters

Copy requires the from file parameter, which provides the information necessary for identifying the file or files you wish to copy.

After the from file, you may specify the optional parameter to file, which is the name (and path, if required) of the file you are creating.

PRN: allows you to copy the file indicated in the from file to the printer attached to the first parallel port on DOS systems. This string must be translated with the SUBSTITUTE specification in BRConfig.sys to specify the appropriate output device on Linux systems.

AUX: copies the from file file to the printer attached to the first serial port. This string must be translated with the SUBSTITUTE specification for Business Rules! Linux versions.

In place of the PRN: or AUX: parameters, you may also specify COM1:, COM2:, LPT1:, LPT2:, etc. to indicate the port to which your printer is attached (see the drive discussion in the Definitions chapter for more information). These device references will operate properly only on Business Rules DOS versions. They may be mapped to new references with the BRConfig.sys file's SUBSTITUTE specification.

The redirection symbol in the >file-ref parameter saves messages that normally appear on the screen to the specified file. The PRINT parameter sends these same messages to the printer rather than to the screen or a file.

Option may be one or more of several optional parameters. Such option(s) can follow the copy command when separated from the rest of the command with a dash:

-A tells the system to copy only files that have the archive bit on. The system turns the archive bits in the original files off when the copying process is complete. This option applies to Business Rules! DOS versions only.
-C prompts for a diskette change if the disk is full.
-D omits deleted records from the copy, but responds only when used with internal files. It is important to rebuild all related index files after using this option.
-N prevents the screen from showing a log of performed actions.
-P causes scrolling to pause after a full screen of information has been displayed. (Press <CR> for next screen.)
-S option has been added to allow copying of a file which is currently open. The file to be copied must be opened for sharing (SHR or SHRI) if it is opened NOSHR, error 4148 (file sharing violation) will occur when COPY with the -S is attempted.
-V requires the operator to Verify each action before Business Rules! performs it.
-# represents output file record length. Internal file record lengths are shortened or expanded (with blanks) to match the number you indicate (version 2.04+). When specified with other options, the record length must always be last.

Technical Considerations

Prior to version 3.0 the -S switch meant preserve space. That syntax is no longer supported. -s now refers to file sharing as noted above.


COPY to a printer :DEVICE was being rejected. COPY to a PRN: or WIN: device is still illegal. (Use TYPE with redirection for PRN: and WIN:)

Client Server

COPY    filename      @:filename      (@ indicates Client system)

Copies filename TO client current directory

(Or specify @:pathname relative to client current directory.)

COPY      @:filename      filename

Copies filename FROM client current directory.

If you are trying to use absolute paths on the client, specify @::

This is really most useful with OPEN: and SAVE: file selection browsers.

Use caution when using absolute paths on the client because permissions and file systems can be different from one computer to another.

Normally BR will use the startup directory to copy things and you can change this in the shortcut if needed.