Home Page The Club Computers News Links Glossary EYAWTK
Before Amiga Background ICS OCS ECS AGA ??? PPC
U-Boot SLB Linux Amiga OS Dual Boot Motherboards Peripherals Other
Initialisation Installation OS4 Updates About OS4 File Systems Networking Printing Other
Introduction File System Workbench Preferences Commands Error Msgs Miscellaneous

AmigaOS 4.0 - About OS4 - Commands

Purpose: To copy files or directories.
Path: C:COPY
COPY copies the file(s) or directory(s) specified with the FROM argument to the file or directory specified by the TO argument. You can copy several files at once by giving more than one FROM argument; each argument should be separated by spaces. You can use pattern matching to copy or exclude items whose names share a common set of characters or symbols.

If a TO filename already exists, COPY overwrites the TO file with the FROM file except when the NOREP or NOREPLACE option has been specified, or the NEWER option has been specified and the creation or last revised date (whichever is most recent) of the FROM file is earlier than the TO file. If you name a destination directory that does not exist, COPY will fail with an 'object not found' error. If you do not specify a directory, it will default to the current directory. If you use a pair of double quotes ("") as the destination, it will default to the current directory using the same name as the FROM file - of course this is only logical if the FROM file is in a different directory.

If the FROM argument is a directory, only the directory's files will be copied; its sub-directories will not be copied. Use the ALL option to copy the complete directory, including its files, sub-directories and the sub-directories' files. If you want to copy a directory and you want the copy to have the same name as the original, you must include the directory name in the TO argument.

COPY displays to the screen the name of each file as it is copied. This can be overridden by the Q or QUIET option.

The BUF or BUFFER option is used to set the number of 512-byte buffers used during the copy. (The default is 200 buffers, approximately 100K of RAM.) It is often useful to limit the number of buffers when copying to RAM:. BUF 0 or BUFFER 0 uses a buffer the same size as the file to be copied.

Normally, COPY gives the TO file the date and time the copy was made, rather than the date and time the file was created or last revised. Any comments attached to the original FROM file are ignored. However, the protection bits of the FROM file are copied to the TO file. The protection bits of the FROM file are not altered. Several options allow you to override these defaults:

DATES The creation or last revised date (whichever is most recent) of the FROM file is copied to the TO file.
COM or COMMENTS Any comment attached to the FROM file is copied to the TO file.
The protection bits of the FROM file are NOT copied to the TO file. The TO file will be given the standard protection bits of r, w, e and d.
ARC or ARCHIVE The Archived protection bit of the FROM file is set to a.
CLONE The creation (or last revised) date, comments and protection bits of the FROM file are copied to the TO file.

Normally COPY displays a requester if the copy cannot continue for some reason. When the NOREQ or NOREQUESTERS option is given, all requesters are suppressed. This is useful in scripts and can prevent a COPY failure from stopping the script while it waits for a response. For example, if a script calls for a certain file to be copied and the system cannot find that file, normally the script would display a requester and would wait until a response was given. With the NOREQ or the NOREQUESTERS option, the COPY command would be aborted and the script would continue.

The INTER or INTERACTIVE option checks if the destination file already exists. In this is the case, you will be prompted to confirm whether you want the file to be overwritten (answer 'y' for 'yes').

The FORCE option can be used when the destination file cannot be created because there is already a file with the same name that is protected against deletion or writing, in which case the protection will be removed first before the destination file is created.

The COPYLINKS option specifies that COPY should copy the contents of a file referenced by a hard or soft link. The default is to skip copying linked files.

The FOLLOWLINKS option specifies that COPY should follow hard and soft links to directories. The default is to skip links to directories.

Example 1:

3.OS4:> COPY File1 TO Dir2/File2
Copies File1 in the current directory to File2 in the Dir2 directory on the system disk.

Example 2:

3.OS4:> COPY ~(#?.info) TO FD1:Backup
Copies all of the files not ending '.info' in the current directory to the Backup director on the disk in FD1: This is a convenient use of pattern matching to save storage space when icons are not necessary.

Example 3:

3.OS4:> COPY Work:Test TO ""
Copies the files in the Test directory on Work: to the current directory; subdirectories in Test will not be copied.

Example 4:

3.OS4:> COPY Work:Test TO FD0:Test ALL
Copies all of the files and any sub-directories of the Test directory on Work: to the Test directory on FD0:.

Example 5:

Copies all of the files and directories of the disk in FD0: to FD1:, without displaying on the screen any of the file/directory names as they are copied. (This is quite slow in comparison to DiskCopy.)

Return to Commands Selection

Disclaimer: Amiga Auckland have prepared the above information for the use of its members based on our experiences and as such is subject to revision at any time. Amiga Auckland cannot guarantee any of the information and cannot be held accountable for any issues that may result from using it.

Copyright 2006 Amiga Auckland Inc. All rights reserved.
Revised: December 24, 2006.