Copies one or more files, or an entire directory tree.
> cop '***/*.html' '/backup/***/*.htm' -before=yesterday Copied to: /home/chris/backup/about.htm Copied to: /home/chris/backup/index.htm Created dir: /home/chris/backup/doc/ Copied to: /home/chris/backup/doc/00readme.htm Created dir: /home/chris/backup/doc/old Copied to: /home/chris/backup/doc/old/index.htm 19 kb copied, 4 files
cop accepts the same wildcards
and file selection options
as the d directory command.
Under Linux, filenames that contain wildcards must be enclosed in quotes, to prevent the shell from expanding the wildcards.
The cop command supports version numbers. If an output file already exists, it is not overwritten. Instead it is renamed with a version number before the input file is copied.
cop cannot be used to concatenate files.
> cop a.xyz b.xyz
The first parameter is an input file specification. cop
accepts the same wildcards as
the d
directory command.
See File Specifications.
The command will normally not copy directory files. If you want it to, you must add the -directories option to the command line.
Unlike the d directory command, cop does not add any defaults to the input file specification, so you must specify all wildcards explicitly.
This makes cop a bit more less generous than the d directory command, just like the rena (rename) command. This stinginess is intentional.
| *.*.* | All versions of all files in the directory. |
| *.* *.*. |
The highest version of all files in the
directory,
but not the previous versions.
Both variants have the same meaning. The first one is
shortest. |
| * *. |
The highest version of all files in the directory that have
an empty extension. Note that this is different from how a Unix shell would
interpret a single asterisk. It is also different from the meaning it
has in the d directory command, where wildcards for extension
and version number are added automatically. |
| *..* *.~*~ |
All versions of all files in the directory that
have
an empty extension.
If you use the syntax with only one dot, the tildes are required, or the last asterisk will be interpreted as "all extensions" rather than "all versions". |
If you want to give a list of input files, they must be enclosed in parentheses (to separate them from the second parameter, which is the output file specification).
> cop (*.html x.css *.gif) publish\
> cop \('*.html' x.css '*.gif'\) publish/
> cop a.xyz b.xyz
The second parameter is an output file specification, which is described on the page Output File Specifications.
The rest of the description here deals with specifics for the cop command.
In cop you must always specify something as the output file specification, or you will get an error message saying "required parameter missing". If you just want to copy files to the current working directory without changing their names, the easiest is to write a dot . (for current directory) as the output specification.
> cop \somewhere\else\*.html .copies the files to the current directory.
If you want to copy files to another directory without changing their names, you can omit the name and extension wildcards in the output file specification.
> cop *.html publish\
> cop '*.html' publish/
> cop mydir\***\*.*.* backup\mydir\*** -directories=also
> cop 'mydir/***/*.*.*' 'backup/mydir/***' -directories=alsoThe -directories option is only required if you want the cop command to copy empty subdirectories from the input directory tree as well. These will otherwise be ignored, as the cop command has the option -nodirectories set by default.
The output subdirectories that are needed to hold the output files will always be created as required when you use the *** directory wildcard, however, whether you use the -directories=also option or not.
If you try to copy a directory by just giving its name (without any directory wildcards like ***), the best you can achieve is to create a new empty directory.
> cop mydir backup\ [warning] No such file: mydir -nodirectories No files copiedNothing at all gets copied (even if mydir does in fact exist), since the -directories file selection option was not specified.
> cop mydir backup\ -directories=also Created dir: E:\glindra\test\backup\mydir 0 byte copied, 1 fileOkay, but the newly created backup\mydir will be empty even if mydir contained files and/or subdirectories.
> cop ***\*.* data\*** -exclude=(.doc .txt) -before=today -min_size=2mb -hidden=also
> cop '***/*.*' 'data/***' -exclude=(.doc .txt) -before=today -min_size=2mb -hidden=also
| -since [= datetime] | Select files that were created on or after a certain date/time. |
| -before [= datetime] | Select file that were created before a certain date/time. |
| -min_size [= size] | Specify a minimum file size in bytes, Mb, or some other unit |
| -max_size [= size] | Specify a maximum file size . |
|
-directories
[= only/also/not]
|
List directory files (only/also/not) . Default is also. |
| -hidden [= only/also/not] | List hidden files (only/also/not). Default is not. |
| -nodefault | Do not add any default wildcards or other filename parts to
the filename. For the cop command, option is used to suppress wildcards in the output file specification. (The input file specifications has no default wildcards to suppress.) |
| -exclude [= filespec] | Exclude files that match the file specification given as option value. If the option value is enclosed in parenthesis, it can contain a full file specification, including recursive file selection options. |
These options control which files are selected. See File Selection Options.
> cop *.* \export\*.* -nospace
> cop '*.*' '/export/*.*' -nospaceCopies files and makes sure that the output filenames do not contain any spaces or any of the most problematic characters.
| -safe |
|
| -portable | Performs the same cleanup operations as -safe, and
additionally:
|
| -lower -upper -title |
Converts the filenames to lower, UPPER, or Title Case. |
| -nospace | Maps all spaces to underscore. |
| -nodash | Maps all dashes (hyphens) to underscore. |
These options are used to clean up filenames while copying files. See Filename Cleanup Options.
> cop *.log *.oldlog -nowarning
> cop '*.log' '*.oldlog' -nowarning
| Print out a brief help text with a summary of each of the different options, and exit from the program. | |
| -version | Show the name and version number of the program, and exit.
This option must be written out in full, and cannot be abbreviated. |
| -verbose
-v -statistics -noverbose |
Specify the amount of informational messages. |
| -warning -nowarning -noerror |
Specify the level of error reporting. |