cp
Syntax
cp[-r][-q]src src...[dst]
Description
Copies one or more source files or directories to a destination.
Options
-r
Creates a recursive copy.
-q
Creates a quiet copy (with no prompt).
src src...
Specifies a source file or directory name. Wildcards are permitted.
dst
Specifies a destination file or directory name. Wildcards are not permitted. If not specified, the current working directory is assumed to be the destination. If more than one directory is specified, the last is always assumed to be the destination.
Usage
If the source is a directory, the
-r
flag must be specified. If
-r
is specified, the source directory is recursively copied to the destination (which means that all subdirectories are copied). If a destination is not specified, the current working directory is assumed to be the destination.
If any target file (not directory) already exists, a prompt appears, asking you to confirm replacing the file. The following choices are available:
Yes
—Replaces the file.No
—Does not replace the file.All
—Replaces the existing files in all subsequent cases.Cancel
—Does not replace any existing files in all subsequent cases.
If there are multiple source files/directories, the destination must be a directory.
If an error occurs, the copying process stops immediately.
When executing in a script, the default is
–q
.
When copying to another directory, the directory must already exist.
Examples
To display the contents of the current directory:
fs0:\> ls
Directory of: fs0:\ 06/18/01 01:02p <DIR> 512 efi
06/18/01 01:02p <DIR> 512 test1
06/18/01 01:02p <DIR> 512 test2
06/13/01 10:00a 28,739 IsaBus.efi
06/13/01 10:00a 32,838 IsaSerial.efi
06/18/01 08:04p 29 temp.txt
06/18/01 08:05p <DIR> 512 test
3 File(s) 61,606 bytes
4 Dir(s)
To copy a file in the same directory and change the file name:
fs0:\> cp temp.txt readme.txt
copying fs0:\temp.txt -> fs0:\readme.txt
- [ok]
To copy multiple files to another directory:
fs0:\> cp temp.txt isaBus.efi \test
copying fs0:\temp.txt -> fs0:\test\temp.txt
- [ok]
copying fs0:\isaBus.efi -> fs0:\test\IsaBus.efi
- [ok]
To copy multiple directories recursively to another directory:
fs0:\> cp -r test1 test2 boot \test
copying fs0:\test1 -> fs0:\test\test1
copying fs0:\test1\test1.txt -> fs0:\test\test1\test1.txt
- [ok]
copying fs0:\test2 -> fs0:\test\test2
copying fs0:\test2\test2.txt -> fs0:\test\test2\test2.txt
- [ok]
copying fs0:\boot -> fs0:\test\boot
copying fs0:\boot\shell.efi -> fs0:\test\boot\shell.efi
- [ok]
To see the results of the above operations:
fs0:\> ls \test
Directory of: fs0:\test 06/18/01 01:01p <DIR> 512
06/18/01 01:01p <DIR> 0 ..
01/28/01 08:21p <DIR> 512 test1
01/28/01 08:21p <DIR> 512 test2
01/28/01 08:21p <DIR> 512 boot
01/28/01 08:23p 29 temp.txt
01/28/01 08:23p 28,739 IsaBus.efi
2 File(s) 28,828 bytes
5 Dir(s)
Shell>