Updated June 2011; 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 AMOS-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 AMOS-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 AMOS-style or native operating syntax. AMOS-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 AMOS-style filespecs.
switches
Switch |
Function |
/D |
Delete: overwrites an existing output file. |
/Q |
Query: prompts for a confirmation before copying each of the input files. |
/C |
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. |
If all of the files on the command line (input and output) are in AMOS-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 the miame.ini.
COPY.LIT and MOVE.LIT are identical. Their behavior changes based on the name of the module. Both use MIAMEX, 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"
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 the 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 the miame.ini is.)
.COPY "/tmp/backup of app.log" = OPR:APP.LOG
.COPY ASHELL.LST = "%MIAME%\ashlog.log"
History
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.