ECP

Section: User Contributed Perl Documentation (1)
Updated: 2017-03-16
Index Return to Main Contents

NAME

ecp - copies files across ECFS domains, including UNIX

SYNOPSIS

ecp [-n|-e|-o|-u|-t][-p][-b] source1 ... target

ecp [-n|-e|-o|-u|-t][-p][-b] -F sourcelist target

DESCRIPTION

If there are two or more source files (which may be patterns) the target must be a directory into which those source files will then be copied.

The sources are usually given within the command line (synopsis 1). But they may alternatively be listed, one per line, in a sourcelist file (synopsis 2).

If target does not exist, it will be automatically created following the same conventions as for UNIX.

There are two significant differences in behaviour from the UNIX cp command:

*
it will automatically create missing directories in the target path;
*
if the target file already exists, then overwriting needs explicit consideration: see options '-n', '-e', '-o', '-u', '-t'.

The source files must all be in one domain (that is, either local or in ECFS) and the target must be in a different domain.

Filename pattern-matching may be used. In doing so, however, careful thought needs to be exercised concerning which domain (local or ECFS) does the pattern matching, and therefore what command-line quoting of pattern specifications is needed to achieve this.

OPTIONS

Options controlling whether or not to overwrite an existing target file:
-n
Do not overwrite. Do not treat as an error condition (return code 0). Envisage it as ``if the target already exists then don't update''.

Equivalent to the same flag on Linux cp. Unlike the Linux command, this is the default behaviour.

-e
Do not overwrite. Treat as an error condition (return code 1). Envisage it as ``I expect the target should not yet exist; if it already exists this is an error''.
-o
Overwrite the existing file. Envisage it as ``always overwrite'', as would happen with a UNIX cp.
-u
Overwrite only if the existing target is older than the requested source. Do not treat as an error condition (return code 0). Envisage it as ``if the target is out of date, then update''.

Equivalent to the same flag on Linux cp.

-t
Synonym of -u (for backwards compatibility with the earlier client).

Other options:

-p
The file's timestamps, group and permission will be kept if possible. Sometimes this may not be possible. For instance HPSS, which undergirds the ECMWF 'ec' domains, cannot preserve timestamps on empty (zero-length) files.
-b
Create also a backup copy of the file on the ECMWF Disaster Recovery System. By default, no backup is created.
--parents
Usually when a source pathname is copied to a target directory, the target file is the leafname of the source path directly in the target directory. With --parents the source pathname structure, with its directory tree, is replicated into the target. See examples section.
--dry-run
Indicates what the copy would do without actually performing it.

NOTES

When using "-F sourcelist" specify exactly one file (or pattern) per line. At present leading and trailing space is stripped from each line; lines starting with '#' are treated as comments and skipped; empty lines are skipped. But any future support of such niceties is not guaranteed.

EXAMPLES

ecp foo ec:foo
ecp foo ec:
These two commands are equivalent, copying the file 'foo' from the local client's current working directory into file 'foo' in the user's ECFS current working directory. But if the ECFS 'foo' already exists, the overwrite will not be done, because of the default '-n' behaviour.
ecp -o foo ec:foo
As per the previous example, except that the overwrite will always happen.
ecp -t foo ec:foo
As per the previous examples, except that the overwrite will be done only if the source file 'foo' is more recent than the destination 'ec:foo'.
ecp foo* ec:
Copy multiple source files, whose names match the pattern 'foo*', into ECFS.
ecp 'ec:foo*' .
Copy multiple local source files, whose names match the pattern 'foo*', from ECFS into the current UNIX working directory. Note the quotation marks around the source specification. This is to prevent the local shell attempting the pattern matching of remote files so that it instead passes the pattern to the ECFS domain.
ecp subdir1/subdir2/foo ec:tgtdir/
The target pathname is "ec:tgtdir/foo".
ecp --parents subdir1/subdir2/foo ec:tgtdir/
In contrast to the previous example, by specifying the --parents flag the target pathname is "ec:tgtdir/subdir1/subdir2/foo".

SEE ALSO

ecfs(1), ecp(1), emv(1), emv(1)


Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
NOTES
EXAMPLES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 14:51:58 GMT, July 23, 2018