Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / html / python / dist / module-distutils.fileutil.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="dist.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index' />
<link rel="first" href="dist.html" title='Distributing Python Modules' />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="module-distutils.util.html" />
<link rel="prev" href="module-distutils.dirutil.html" />
<link rel="parent" href="api-reference.html" />
<link rel="next" href="module-distutils.util.html" />
<meta name='aesop' content='information' />
<title>10.12 distutils.file_util -- Single file operations</title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="10.11 distutils.dir_util "
href="module-distutils.dirutil.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="10. API Reference"
href="api-reference.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="10.13 distutils.util "
href="module-distutils.util.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Distributing Python Modules</td>
<td class='online-navigation'><img src='../icons/blank.png'
border='0' height='32' alt='' width='32' /></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-distutils.dirutil.html">10.11 distutils.dir_util </A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="api-reference.html">10. API Reference</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-distutils.util.html">10.13 distutils.util </A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION00101200000000000000000">
10.12 <tt class="module">distutils.file_util</tt> -- Single file operations</A>
</H1>
<A NAME="module-distutils.fileutil"></A>
<P>
This module contains some utility functions for operating on individual files.
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-75' xml:id='l2h-75' class="function">copy_file</tt></b>(</nobr></td>
<td><var>src, dst</var><big>[</big><var>preserve_mode=<code>1</code>, preserve_times=<code>1</code>, update=<code>0</code>, link=<code>None</code>, verbose=<code>0</code>, dry_run=<code>0</code></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Copy file <var>src</var> to <var>dst</var>. If <var>dst</var> is a directory, then
<var>src</var> is copied there with the same name; otherwise, it must be a
filename. (If the file exists, it will be ruthlessly clobbered.) If
<var>preserve_mode</var> is true (the default), the file's mode (type and
permission bits, or whatever is analogous on the current platform) is
copied. If <var>preserve_times</var> is true (the default), the last-modified
and last-access times are copied as well. If <var>update</var> is true,
<var>src</var> will only be copied if <var>dst</var> does not exist, or if
<var>dst</var> does exist but is older than <var>src</var>.
<P>
<var>link</var> allows you to make hard links (using <tt class="function">os.link</tt>) or
symbolic links (using <tt class="function">os.symlink</tt>) instead of copying: set it
to <code>'hard'</code> or <code>'sym'</code>; if it is <code>None</code> (the default),
files are copied. Don't set <var>link</var> on systems that don't support
it: <tt class="function">copy_file()</tt> doesn't check if hard or symbolic linking is
available. It uses <tt class="function">_copy_file_contents()</tt> to copy file contents.
<P>
Return a tuple "<tt class="samp">(dest_name, copied)</tt>": <var>dest_name</var> is the actual
name of the output file, and <var>copied</var> is true if the file was copied
(or would have been copied, if <var>dry_run</var> true).
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-76' xml:id='l2h-76' class="function">move_file</tt></b>(</nobr></td>
<td><var>src, dst</var><big>[</big><var>verbose, dry_run</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Move file <var>src</var> to <var>dst</var>. If <var>dst</var> is a directory, the file will
be moved into it with the same name; otherwise, <var>src</var> is just renamed
to <var>dst</var>. Returns the new full name of the file.
<span class="warning"><b class="label">Warning:</b>
Handles cross-device moves on Unix using <tt class="function">copy_file()</tt>.
What about other systems???</span>
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-77' xml:id='l2h-77' class="function">write_file</tt></b>(</nobr></td>
<td><var>filename, contents</var>)</td></tr></table></dt>
<dd>
Create a file called <var>filename</var> and write <var>contents</var> (a
sequence of strings without line terminators) to it.
</dl>
<P>
<DIV CLASS="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="10.11 distutils.dir_util "
href="module-distutils.dirutil.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="10. API Reference"
href="api-reference.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="10.13 distutils.util "
href="module-distutils.util.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Distributing Python Modules</td>
<td class='online-navigation'><img src='../icons/blank.png'
border='0' height='32' alt='' width='32' /></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-distutils.dirutil.html">10.11 distutils.dir_util </A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="api-reference.html">10. API Reference</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-distutils.util.html">10.13 distutils.util </A>
</div>
</div>
<hr />
<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>