204 lines
6.5 KiB
HTML
204 lines
6.5 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||
|
<meta http-equiv="Content-Type" content=
|
||
|
"text/html; charset=utf-8">
|
||
|
<title>cp - Copy files</title>
|
||
|
<LINK rel="stylesheet" type="text/css" href="../rzahg/ic.css">
|
||
|
</HEAD>
|
||
|
<body bgcolor="#FFFFFF">
|
||
|
<!-- Java sync-link -->
|
||
|
<SCRIPT LANGUAGE="Javascript" SRC="../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
|
||
|
|
||
|
|
||
|
|
||
|
<h2>cp - Copy files</h2>
|
||
|
|
||
|
<strong>Synopsis</strong>
|
||
|
|
||
|
<p><strong>cp [-r | -R [-H | -L | -P] ] [-fhipt]</strong> <em>
|
||
|
source_file target_file</em></p>
|
||
|
|
||
|
<p><strong>cp [-r | -R [-H | -L | -P] ] [-fhipt]</strong> <em>
|
||
|
source_file ... target_directory</em></p>
|
||
|
|
||
|
<p><strong>Description</strong></p>
|
||
|
|
||
|
<p>In the first synopsis form, the <strong>cp</strong> utility
|
||
|
copies the contents of the <em>source_file</em> to the <em>
|
||
|
target_file</em>.</p>
|
||
|
|
||
|
<p>In the second synopsis form, the <strong>cp</strong> utility
|
||
|
copies the contents of each named <em>source_file</em> to a file in
|
||
|
the destination <em>target_directory</em>. The names of the files
|
||
|
themselves are not changed. The <em>target_directory</em> must
|
||
|
exist unless there is only one named <em>source_file</em> which is
|
||
|
a directory and the <strong>-R</strong> flag is specified.</p>
|
||
|
|
||
|
<p>If <strong>cp</strong> detects an attempt to copy a file to
|
||
|
itself, the copy will fail.</p>
|
||
|
|
||
|
<p>If <em>target_file</em> does not exist, the mode of the <em>
|
||
|
source_file</em> is used, as modified by the file creation mask,
|
||
|
when creating <em>target_file</em>. The S_ISUID and S_ISGID file
|
||
|
permission bits are never set when creating a new file.</p>
|
||
|
|
||
|
<p>If <em>target_file</em> already exists and the <strong>
|
||
|
-t</strong> option is not specified, its contents are overwritten
|
||
|
as binary data and the CCSID attribute is changed to match the
|
||
|
CCSID attribute of <em>source_file</em>. The file permission bits,
|
||
|
owner, and group of <em>target_file</em> are unchanged. You can
|
||
|
force the data to be copied as text data by using the <strong>
|
||
|
-t</strong> option. You can force the file permission bits, owner,
|
||
|
and group to be copied using the <strong>-p</strong> option.</p>
|
||
|
|
||
|
<p>Note that when copying to members in the QSYS.LIB file system,
|
||
|
many attributes of <em>source_file</em> cannot be preserved because
|
||
|
they are associated with the file object and not the member.</p>
|
||
|
|
||
|
<p>Symbolic links are always followed unless the <strong>
|
||
|
-h</strong> option is specified or the <strong>-R</strong> option
|
||
|
is specified with the <strong>-H</strong> or the <strong>
|
||
|
-L</strong> options. The <strong>-H</strong>, <strong>-L</strong>
|
||
|
and <strong>-P</strong> options are ignored unless the <strong>
|
||
|
-R</strong> option is specified. In addition, these options
|
||
|
override each other and the command's actions are determined by the
|
||
|
last one specified.</p>
|
||
|
|
||
|
<p><strong>Options</strong></p>
|
||
|
|
||
|
<dl>
|
||
|
<dt><strong>-H</strong></dt>
|
||
|
|
||
|
<dd>If the <strong>-R</strong> option is specified, symbolic links
|
||
|
on the command line are followed. Symbolic links encountered in the
|
||
|
tree traversal are not followed and the symbolic link is copied
|
||
|
instead of the file pointed to by the symbolic link.</dd>
|
||
|
|
||
|
<dt><strong>-L</strong></dt>
|
||
|
|
||
|
<dd>If the <strong>-R</strong> option is specified, both symbolic
|
||
|
links on the command line and symbolic links encountered in the
|
||
|
tree traversal are followed.</dd>
|
||
|
|
||
|
<dt><strong>-P</strong></dt>
|
||
|
|
||
|
<dd>If the <strong>-R</strong> option is specified, no symbolic
|
||
|
links are followed. A symbolic link encountered in the tree
|
||
|
traversal is copied instead of the file pointed to by the symbolic
|
||
|
link.</dd>
|
||
|
|
||
|
<dt><strong>-R</strong></dt>
|
||
|
|
||
|
<dd>If <em>source_file</em> designates a directory, <strong>
|
||
|
cp</strong> copies the directory and the entire subtree connected
|
||
|
at that point. This option causes <strong>cp</strong> to create
|
||
|
special files rather than copying them as normal files. Created
|
||
|
directories have the same mode as the corresponding source
|
||
|
directory, unmodified by the file creation mask.</dd>
|
||
|
|
||
|
<dt><strong>-f</strong></dt>
|
||
|
|
||
|
<dd>Remove <em>target_file</em> if it cannot be opened for write
|
||
|
operations. A new file is created before the data is copied.</dd>
|
||
|
|
||
|
<dt><strong>-h</strong></dt>
|
||
|
|
||
|
<dd>Copy symbolic links instead of the file pointed to by the
|
||
|
symbolic link.</dd>
|
||
|
|
||
|
<dt><strong>-i</strong></dt>
|
||
|
|
||
|
<dd>Write a prompt to standard error before copying a file that
|
||
|
would overwrite an existing file. If the response from the standard
|
||
|
input begins with the first character for the YES response in the
|
||
|
current locale, the file copy is attempted.</dd>
|
||
|
|
||
|
<dt><strong>-p</strong></dt>
|
||
|
|
||
|
<dd>Preserve in the copy as many of the modification time, access
|
||
|
time, file permission bits, owner, and group as allowed by
|
||
|
permissions.
|
||
|
|
||
|
<p>If the owner and group cannot be preserved, no error message is
|
||
|
displayed and the exit value is not altered.</p>
|
||
|
|
||
|
<p>The S_ISUID and S_ISGID file permission bits are only copied
|
||
|
when both the owner and group of the file are successfully
|
||
|
copied.</p>
|
||
|
|
||
|
<table>
|
||
|
<tr>
|
||
|
<td valign="top"><strong>Note:</strong></td>
|
||
|
<td>This option has no effect when copying to the QSYS.LIB file
|
||
|
system.</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
|
||
|
<dt><strong>-r</strong></dt>
|
||
|
|
||
|
<dd>Same as <strong>-R</strong> except this option copies special
|
||
|
files in the same manner as regular files. The <strong>-R</strong>
|
||
|
flag is preferred to the <strong>-r</strong> flag.</dd>
|
||
|
|
||
|
<dt><strong>-t</strong></dt>
|
||
|
|
||
|
<dd>When the target file exists, treat the data in <em>
|
||
|
source_file</em> as text data and translate the data to the CCSID
|
||
|
associated with <em>target_file</em> as it is copied. The CCSID
|
||
|
attribute of <em>target_file</em> is not changed.</dd>
|
||
|
</dl>
|
||
|
|
||
|
<p><strong>Exit Status</strong></p>
|
||
|
|
||
|
<ul>
|
||
|
<li>0 on success</li>
|
||
|
|
||
|
<li>>0 if an error occurred.</li>
|
||
|
</ul>
|
||
|
|
||
|
<p><strong>Related information</strong></p>
|
||
|
|
||
|
<ul>
|
||
|
<li><a href="ln.htm">ln - Link files</a></li>
|
||
|
|
||
|
<li><a href="ls.htm">ls - List directory contents</a></li>
|
||
|
|
||
|
<li><a href="mv.htm">mv - Move files</a></li>
|
||
|
|
||
|
<li><a href="rm.htm">rm - Remove directory entries</a></li>
|
||
|
|
||
|
<li><a href="rmdir.htm">rmdir - Remove directories</a></li>
|
||
|
|
||
|
<li><a href="umask.htm">umask - Get or set the file mode creation
|
||
|
mask</a></li>
|
||
|
</ul>
|
||
|
|
||
|
<strong>Examples</strong>
|
||
|
|
||
|
<ol>
|
||
|
<li>Copy the file, "file1", into the subdirectory, "data.dir".
|
||
|
|
||
|
<pre>
|
||
|
cp file1 data.dir
|
||
|
</pre>
|
||
|
</li>
|
||
|
|
||
|
<li>Copy all the files with the .java extension from the "code"
|
||
|
subdirectory into the subdirectory, "code/old_code.dir" and prompt
|
||
|
the user for overwrite verification only if the file already exists
|
||
|
in the subdirectory, "code/old_code.dir".
|
||
|
|
||
|
<pre>
|
||
|
cp -i code/*.java code/old_code.dir
|
||
|
</pre>
|
||
|
</li>
|
||
|
</ol>
|
||
|
|
||
|
<!-- end ibmbody========================================================= -->
|
||
|
</body>
|
||
|
</html>
|
||
|
|