COPY

Updated May 2022; see History

COPY copies files from one place or name to another.

COPY {outspec} = inspec1 {inspec2, … inspectN} {switches}

Parameters

outspec

specifies an output file, using either DevPPN-style (e.g. dsk1:myfile.dat[123.4]) or native operating system, in which case it must be enclosed in quotes (e.g. "c:\temp\somefile.xyz"). When dealing exclusively with DevPPN-style inspec files, outspec may be omitted, in which case it acts like *.*—i.e. uses the name.ext of each inspec file.

inspec

specifies an input file, using either DevPPN-style or native operating syntax. DevPPN-style filespecs may include the * and ? and [] wildcards (e.g. DSK2:[]*.TMP). Native filespecs must be quoted and may not contain wildcards. When the outspec is blank or *.*, you may list more than one inspec, provided they are all DevPPN-style filespecs.

switches

 

Switch

Function

/D{elete}

Delete: overwrites an existing output file.

/Q{uery}

Query: prompts for a confirmation before copying each of the input files.

/C{onfirm}

Similar to {/query} except that it only prompts you to confirm whenever the destination already exists. Note: if you are prone to accidentally overwriting important files by loose-fingered copy commands, you may want to rename COPY.LIT to something else, then create a copy.do file which automatically invokes the /C switch.

/mindays:#

Ignore files changed within the last # days.

/minsecs:#

Ignore files changed within the last # seconds.

/NOD

No delete: does not overwrite existing files.

/?

Writes switch listing and usage info to the screen.

 

Comments

If all of the files on the command line (input and output) are in DevPPN-style syntax, the wildcards * and ? and [] may be used on both sides of the equals (e.g. COPY DSK1:*.X?[] = DSK2:*.D?[]).

COPY preserves the modification time and ownership of the source file.

COPY skips wildcarded source files that have more than one extension, and displays a warning message listing the filename. You can still copy such a files using quoted native filespecs.

Copying from read-only devices under Windows: In general, COPY will try to preserve the attributes of the source file, such as the last-modified time stamp, archive bit, etc. One notable exception is that when copying from a read-only device (like a CD), it will remove the read-only attribute from the output file. (Otherwise files copied from CD would typically need manual adjustment to remove the read-only attribute.) However, this feature only works for source devices that A-Shell can detect as being naturally read-only. If this is not the case, you can force A-Shell to recognize the device as read-only by adding the ,RO flag to the DEVICE definition in miame.ini.

COPY.LIT and MOVE.LIT are identical. Their behavior changes based on the name of the module. Both use MX_COPYFILE function to perform the operation, the only difference being that MOVE sets the CPYF_MOVE flag.

Native (quoted) filespecs may contain environment variables, e.g. "%miame%\ashlog.log"

 

Examples

The following example simply makes a copy of FILE1.NEW called FILE1.OLD, overwriting an existing FILE1.OLD if necessary.

.COPY FILE1.OLD=FILE1.NEW/D

This example copies the specified file from the SYS: directory to the current directory.

.COPY=SYS:ERSATZ.INI

This makes copy of all of the files with BAS extensions in all of the PPNs of the current device/logical unit, plus the file dsk1:direct.lst. The copies will all be in the current PPN and will all have SAV extensions.

.COPY *.SAV=*.BAS[],DSK1:DIRECT.LST

The following demonstrates the ability to create new directories as needed while copying files. It copies all of the files from DSK0:[50,*] to the corresponding PPN in DSK1:. Note that the ability to create new directories during the COPY operation is only available if you are currently logged into [1,2]. Furthermore, if the OPTIONS=STRICT setting is specified in miame.ini, then you may not create files during a COPY command outside of the current project.

.COPY DSK1:[]=DSK0:[50,*]

The following two examples illustrate the use of a quoted native operating system filespec. In the second case, it also illustrates the use of %ENV% variables.  (%MIAME% is an automatically created environment variable which points to the directory where miame.ini is located.)

.COPY "/tmp/backup of app.log" = OPR:APP.LOG

.COPY ASHELL.LST = "%MIAME%\ashlog.log"

 

History

2022 June, A-Shell 6.5.1717, COPY.LIT / MOVE.LIT 3.4(147):  Updated to fix a very old bug which would result in the directory listing being duplicated if there were consecutive DEVICE statements for the same device—i.e. one normal DEVICE definition and one or more PPN-specific definitions.

2022 May, A-Shell 6.5.1715, COPY.LIT / MOVE.LIT 3.4(146):  Add /MAXDAYS:## and /MAXSECS:## switches to allow selective targeting of files changed recently.

2019 June, A-Shell 6.5.1662, COPY.LIT 3.4(132):  COPY has been updated to accommodate a change in maximum filename.ext size, from 10.3 to 72.8.

2011 June, A-Shell 5.1.1221:  Remove the limit on the number of PPNs allowed per device.

2010 April, A-Shell 5.1.1181:  Add MINDAYS and MINSECS switches.