<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wx="http://ilps.science.uva.nl/WikiXML/wx" xml:lang="it" lang="it">
<head>
<title>Cp (Unix)</title>
<meta name="wx_namespace" content="0"/>
<meta name="wx_pagename" content="Cp_(Unix)"/>
<meta name="wx_page_id" content="1778085"/>
</head>
<body>
<div id="wx_article">
<wx:section level="1" title="Cp (Unix)" id="wxsec1"><h1 class="pagetitle" id="wx1">Cp (Unix)</h1>

<p id="wx2"><wx:template id="wx_t2" pagename="Template:Titolo_minuscolo" page_id="1644834"/><a href="/wit/Template:DISPLAYTITLE:cp_%28Unix%29" class="new" title="Template:DISPLAYTITLE:cp (Unix)" wx:linktype="unknown" wx:pagename="Template:DISPLAYTITLE:cp_(Unix)" id="wx3">Template:DISPLAYTITLE:cp (Unix)</a><wx:templateend start="wx_t2"/>
<b id="wx4">cp</b> (da <b id="wx5">c</b>o<b id="wx6">p</b>y - copia) è un comando dei <a href="/wit/Sistema_operativo" title="Sistema operativo" wx:linktype="known" wx:pagename="Sistema_operativo" wx:page_id="3917" id="wx7">sistemi operativi</a> <a href="/wit/Unix" title="Unix" wx:linktype="known" wx:pagename="Unix" wx:page_id="4363" id="wx8">Unix</a> e <a href="/wit/Unix-like" title="Unix-like" wx:linktype="known" wx:pagename="Unix-like" wx:page_id="52709" id="wx9">Unix-like</a>, e più in generale dei sistemi <a href="/wit/POSIX" title="POSIX" wx:linktype="known" wx:pagename="POSIX" wx:page_id="106127" id="wx10">POSIX</a><sup id="_ref-0" class="reference"><a href="#_note-0" title="" wx:fragment="_note-0" wx:linktype="note" id="wx11"/></sup>, che effettua la copia di <a href="/wit/File" title="File" wx:linktype="known" wx:pagename="File" wx:page_id="14505" id="wx12">file</a> e <a href="/wit/Directory" title="Directory" wx:linktype="known" wx:pagename="Directory" wx:page_id="106238" id="wx13">directory</a>.</p>

<div id="wx_toc"/>

<a id="Uso" name="Uso"/>
<wx:section level="2" title="Uso" id="wxsec2"><h2 id="wx14">Uso</h2>

<p id="wx15">La sintassi generale di <i id="wx16">cp</i> è</p>

<pre id="wx17">
 cp [<i id="wx18">opzioni</i>] <i id="wx19">sorgente1</i> [<i id="wx20">sorgente2..</i>] <i id="wx21">destinazione</i> 
</pre>

<p id="wx22">I parametri <i id="wx23">sorgente</i> indicano i file e/o le directory da copiare. Se viene specificato un solo parametro <i id="wx24">sorgente</i>, il parametro <i id="wx25">destinazione</i> indica il file o la directory di destinazione.</p>

<p id="wx26">Se vengono specificati più parametri <i id="wx27">sorgente</i>, il parametro <i id="wx28">destinazione</i> deve necessariamente essere una directory esistente, o al più un <a href="/wit/Collegamento_simbolico" title="Collegamento simbolico" wx:linktype="known" wx:pagename="Collegamento_simbolico" wx:page_id="590524" id="wx29">collegamento simbolico</a> ad una directory.</p>

<p id="wx30">Tra le opzioni principali troviamo:</p>

<ul id="wx31">
<li id="wx32"><tt id="wx33">-R</tt>
<p id="wx34">– Copia ricorsivamente anche il contenuto di directory.</p>
</li>

<li id="wx35"><tt id="wx36">-i</tt>
<p id="wx37">– Chiede conferma prima di sovrascrivere eventuali file esistenti.</p>
</li>

<li id="wx38"><tt id="wx39">-f</tt>
<p id="wx40">– Nel caso non sia possibile sovrascrivere un file esistente (ad es. per problemi di permessi di scrittura sul file), tenta di levarlo di mezzo rimuovendolo.</p>
</li>
</ul>

<a id="Esempi" name="Esempi"/>
</wx:section><wx:section level="2" title="Esempi" id="wxsec3"><h2 id="wx41">Esempi</h2>

<p id="wx42">Copia <tt id="wx43">file1</tt> in <tt id="wx44">file2</tt>:</p>

<pre id="wx45">
 cp file1 file2
</pre>

<p id="wx46"><br id="wx47"/>
Copia <tt id="wx48">file1</tt> nella directory preesistente <tt id="wx49">dir1</tt>:</p>

<pre id="wx50">
 cp file1 dir1
</pre>

<p id="wx51"><br id="wx52"/>
Copia vari file nella directory preesistente <tt id="wx53">dir2</tt>:</p>

<pre id="wx54">
 cp file1 file2  dir2
</pre>

<p id="wx55"><br id="wx56"/>
Copia ricorsivamente vari file e directory nella directory preesistente <tt id="wx57">backup</tt>:</p>

<pre id="wx58">
 cp -R file1 dir1 file2 dir2  backup
</pre>

<a id="Note" name="Note"/>
</wx:section><wx:section level="2" title="Note" id="wxsec4"><h2 id="wx59">Note</h2>

<ol class="references" id="wx60">
<li id="_note-0"><a href="#_ref-0" title="" wx:fragment="_ref-0" wx:linktype="noteref" id="wx61"><b id="wx62">^</b></a> <wx:template id="wx_t1" pagename="Template:Cita_web" page_id="462025"/><cite id="CITEREF" style="font-style:normal;">(<span style="font-weight:bolder; font-size:80%" id="wx63"><a href="/wit/Lingua_inglese" title="Lingua inglese" wx:linktype="known" wx:pagename="Lingua_inglese" wx:page_id="2523" id="wx64">EN</a></span>) <a href="http://www.opengroup.org/onlinepubs/000095399/utilities/cp.html" class="external text" wx:linktype="external" rel="nofollow" id="wx65">cp</a>  in <i id="wx66">The Open Group Base Specifications Issue 6 IEEE Std 1003.1, 2004 Edition</i>.<small id="wx67"> URL consultato il 18-05-2008</small>.</cite><wx:templateend start="wx_t1"/></li>
</ol>

<a id="Voci_correlate" name="Voci_correlate"/>
</wx:section><wx:section level="2" title="Voci correlate" id="wxsec5"><h2 id="wx68">Voci correlate</h2>

<ul id="wx69">
<li id="wx70"><a href="/wit/Dd_%28Unix%29" title="Dd (Unix)" wx:linktype="known" wx:pagename="Dd_(Unix)" wx:page_id="1777083" id="wx71">Dd (Unix)</a>
<p id="wx72">– Copia dati in blocchi.</p>
</li>
</ul>

<a id="Collegamenti_esterni" name="Collegamenti_esterni"/>
</wx:section><wx:section level="2" title="Collegamenti esterni" id="wxsec6"><h2 id="wx73">Collegamenti esterni</h2>

<ul id="wx74">
<li id="wx75"><wx:template id="wx_t3" pagename="Template:Cita_web" page_id="462025"/><cite id="CITEREF_1" style="font-style:normal;">(<span style="font-weight:bolder; font-size:80%" id="wx76"><a href="/wit/Lingua_inglese" title="Lingua inglese" wx:linktype="known" wx:pagename="Lingua_inglese" wx:page_id="2523" id="wx77">EN</a></span>) <a href="http://www.gnu.org/software/coreutils/manual/html_node/cp-invocation.html" class="external text" wx:linktype="external" rel="nofollow" id="wx78">cp: Copy files and directories</a>  in <i id="wx79">GNU Coreutils manual</i>.<small id="wx80"> URL consultato il 18-05-2008</small>.</cite><wx:templateend start="wx_t3"/>
</li>
</ul>

<wx:template id="wx_t4" pagename="Template:Portale" page_id="949487"/>
<div style="margin-left:0; margin-right:0" id="wx81">
<ul style="display:block; clear:both; list-style-image:none; list-style-type:none; width:100%; vertical-align:middle; margin:0; margin-bottom:1em; padding:0; min-height:27px" id="wx82">
<li style="float:left; height:27px; line-height:25px; width:100%; margin:0; margin-top:.5em; margin-left:0; margin-right:0; padding:0; border:1px solid #CCF; background-color:#F0EEFF" title="Accedi alle voci di Wikipedia che parlano di Informatica" id="wx83"><a href="/wit/Immagine:Stub_Informatica.png" title="Informatica" wx:linktype="image" wx:pagename="Immagine:Stub_Informatica.png" wx:page_id="1387162" id="wx84"><img src="/wit/Immagine:Stub_Informatica.png" alt="Informatica" width="25" height="25" id="wx85"/></a> <b id="wx86"><a href="/wit/Portale:Informatica" class="new" title="Portale:Informatica" wx:linktype="unknown" wx:pagename="Portale:Informatica" id="wx87">Portale Informatica</a></b>
<p id="wx88">:  accedi alle voci di Wikipedia che parlano di Informatica</p>
</li>
</ul>
</div>

<wx:templateend start="wx_t4"/>
</wx:section></wx:section></div>
<div id="wx_categorylinks">
<a href="/wit/index.php?title=Speciale:Categories&amp;article=Cp_%28Unix%29" title="Speciale:Categories" wx:linktype="known" wx:pagename="Speciale:Categories" id="wx89">Categorie</a>: <span dir="ltr" id="wx90"><a href="/wit/Categoria:Unix" title="Categoria:Unix" wx:linktype="known" wx:pagename="Categoria:Unix" wx:page_id="49397" id="wx91">Unix</a></span> | <span dir="ltr" id="wx92"><a href="/wit/Categoria:Comandi_Unix/Linux" title="Categoria:Comandi Unix/Linux" wx:linktype="known" wx:pagename="Categoria:Comandi_Unix/Linux" wx:page_id="503801" id="wx93">Comandi Unix/Linux</a></span></div>
<div id="wx_languagelinks">
Altre lingue: <a href="http://ar.wikipedia.org/wiki/Cp_%28%D9%8A%D9%88%D9%86%D9%83%D8%B3%29" class="external" wx:linktype="interwiki" wx:pagename="ar:Cp_(يونكس)" id="wx94">العربية</a> | <a href="http://cs.wikipedia.org/wiki/Cp" class="external" wx:linktype="interwiki" wx:pagename="cs:Cp" id="wx95">Česky</a> | <a href="http://de.wikipedia.org/wiki/Cp_%28Unix%29" class="external" wx:linktype="interwiki" wx:pagename="de:Cp_(Unix)" id="wx96">Deutsch</a> | <a href="http://en.wikipedia.org/wiki/Cp_%28Unix%29" class="external" wx:linktype="interwiki" wx:pagename="en:Cp_(Unix)" id="wx97">English</a> | <a href="http://es.wikipedia.org/wiki/Cp" class="external" wx:linktype="interwiki" wx:pagename="es:Cp" id="wx98">Español</a> | <a href="http://eu.wikipedia.org/wiki/Cp" class="external" wx:linktype="interwiki" wx:pagename="eu:Cp" id="wx99">Euskara</a> | <a href="http://fi.wikipedia.org/wiki/Unix-ty%C3%B6kaluohjelmat" class="external" wx:linktype="interwiki" wx:pagename="fi:Unix-työkaluohjelmat" id="wx100">Suomi</a> | <a href="http://fr.wikipedia.org/wiki/Cp_%28Unix%29" class="external" wx:linktype="interwiki" wx:pagename="fr:Cp_(Unix)" id="wx101">Français</a> | <a href="http://nl.wikipedia.org/wiki/Cp" class="external" wx:linktype="interwiki" wx:pagename="nl:Cp" id="wx102">Nederlands</a> | <a href="http://pl.wikipedia.org/wiki/Cp_%28Unix%29" class="external" wx:linktype="interwiki" wx:pagename="pl:Cp_(Unix)" id="wx103">Polski</a> | <a href="http://pt.wikipedia.org/wiki/Cp_%28Unix%29" class="external" wx:linktype="interwiki" wx:pagename="pt:Cp_(Unix)" id="wx104">Português</a> | <a href="http://ru.wikipedia.org/wiki/Cp" class="external" wx:linktype="interwiki" wx:pagename="ru:Cp" id="wx105">Русский</a></div>
</body>
<wx:templatearguments for="wx_t1"><wx:argument name="url">
<a href="http://www.opengroup.org/onlinepubs/000095399/utilities/cp.html" class="external free" wx:linktype="external" rel="nofollow" id="wx106">http://www.opengroup.org/onlinepubs/000095399/utilities/cp.html</a>
</wx:argument><wx:argument name="titolo">
<p id="wx107">cp</p>
</wx:argument><wx:argument name="accesso">
<p id="wx108">18-05-2008</p>
</wx:argument><wx:argument name="opera">
<p id="wx109">The Open Group Base Specifications Issue 6 IEEE Std 1003.1, 2004 Edition</p>
</wx:argument><wx:argument name="lingua">
<p id="wx110">en</p>
</wx:argument></wx:templatearguments>
<wx:templatearguments for="wx_t2"/>
<wx:templatearguments for="wx_t3"><wx:argument name="url">
<a href="http://www.gnu.org/software/coreutils/manual/html_node/cp-invocation.html" class="external free" wx:linktype="external" rel="nofollow" id="wx111">http://www.gnu.org/software/coreutils/manual/html_node/cp-invocation.html</a>
</wx:argument><wx:argument name="titolo">
<p id="wx112">cp: Copy files and directories</p>
</wx:argument><wx:argument name="accesso">
<p id="wx113">18-05-2008</p>
</wx:argument><wx:argument name="opera">
<p id="wx114">GNU Coreutils manual</p>
</wx:argument><wx:argument name="lingua">
<p id="wx115">en</p>
</wx:argument></wx:templatearguments>
<wx:templatearguments for="wx_t4"><wx:argument name="1">
<p id="wx116">Informatica</p>
</wx:argument></wx:templatearguments>
</html>
