Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / html / python / dist / module-distutils.fileutil.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="dist.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="dist.html" title='Distributing Python Modules' />
8<link rel='index' href='genindex.html' title='Index' />
9<link rel='last' href='about.html' title='About this document...' />
10<link rel='help' href='about.html' title='About this document...' />
11<link rel="next" href="module-distutils.util.html" />
12<link rel="prev" href="module-distutils.dirutil.html" />
13<link rel="parent" href="api-reference.html" />
14<link rel="next" href="module-distutils.util.html" />
15<meta name='aesop' content='information' />
16<title>10.12 distutils.file_util -- Single file operations</title>
17</head>
18<body>
19<DIV CLASS="navigation">
20<div id='top-navigation-panel' xml:id='top-navigation-panel'>
21<table align="center" width="100%" cellpadding="0" cellspacing="2">
22<tr>
23<td class='online-navigation'><a rel="prev" title="10.11 distutils.dir_util "
24 href="module-distutils.dirutil.html"><img src='../icons/previous.png'
25 border='0' height='32' alt='Previous Page' width='32' /></A></td>
26<td class='online-navigation'><a rel="parent" title="10. API Reference"
27 href="api-reference.html"><img src='../icons/up.png'
28 border='0' height='32' alt='Up One Level' width='32' /></A></td>
29<td class='online-navigation'><a rel="next" title="10.13 distutils.util "
30 href="module-distutils.util.html"><img src='../icons/next.png'
31 border='0' height='32' alt='Next Page' width='32' /></A></td>
32<td align="center" width="100%">Distributing Python Modules</td>
33<td class='online-navigation'><img src='../icons/blank.png'
34 border='0' height='32' alt='' width='32' /></td>
35<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
36 border='0' height='32' alt='Module Index' width='32' /></a></td>
37<td class='online-navigation'><a rel="index" title="Index"
38 href="genindex.html"><img src='../icons/index.png'
39 border='0' height='32' alt='Index' width='32' /></A></td>
40</tr></table>
41<div class='online-navigation'>
42<b class="navlabel">Previous:</b>
43<a class="sectref" rel="prev" href="module-distutils.dirutil.html">10.11 distutils.dir_util </A>
44<b class="navlabel">Up:</b>
45<a class="sectref" rel="parent" href="api-reference.html">10. API Reference</A>
46<b class="navlabel">Next:</b>
47<a class="sectref" rel="next" href="module-distutils.util.html">10.13 distutils.util </A>
48</div>
49<hr /></div>
50</DIV>
51<!--End of Navigation Panel-->
52
53<H1><A NAME="SECTION00101200000000000000000">
5410.12 <tt class="module">distutils.file_util</tt> -- Single file operations</A>
55</H1>
56<A NAME="module-distutils.fileutil"></A>
57
58<P>
59This module contains some utility functions for operating on individual files.
60
61<P>
62<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
63 <td><nobr><b><tt id='l2h-75' xml:id='l2h-75' class="function">copy_file</tt></b>(</nobr></td>
64 <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>
65<dd>
66Copy file <var>src</var> to <var>dst</var>. If <var>dst</var> is a directory, then
67<var>src</var> is copied there with the same name; otherwise, it must be a
68filename. (If the file exists, it will be ruthlessly clobbered.) If
69<var>preserve_mode</var> is true (the default), the file's mode (type and
70permission bits, or whatever is analogous on the current platform) is
71copied. If <var>preserve_times</var> is true (the default), the last-modified
72and last-access times are copied as well. If <var>update</var> is true,
73<var>src</var> will only be copied if <var>dst</var> does not exist, or if
74<var>dst</var> does exist but is older than <var>src</var>.
75
76<P>
77<var>link</var> allows you to make hard links (using <tt class="function">os.link</tt>) or
78symbolic links (using <tt class="function">os.symlink</tt>) instead of copying: set it
79to <code>'hard'</code> or <code>'sym'</code>; if it is <code>None</code> (the default),
80files are copied. Don't set <var>link</var> on systems that don't support
81it: <tt class="function">copy_file()</tt> doesn't check if hard or symbolic linking is
82available. It uses <tt class="function">_copy_file_contents()</tt> to copy file contents.
83
84<P>
85Return a tuple "<tt class="samp">(dest_name, copied)</tt>": <var>dest_name</var> is the actual
86name of the output file, and <var>copied</var> is true if the file was copied
87(or would have been copied, if <var>dry_run</var> true).
88</dl>
89
90<P>
91<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
92 <td><nobr><b><tt id='l2h-76' xml:id='l2h-76' class="function">move_file</tt></b>(</nobr></td>
93 <td><var>src, dst</var><big>[</big><var>verbose, dry_run</var><big>]</big><var></var>)</td></tr></table></dt>
94<dd>
95Move file <var>src</var> to <var>dst</var>. If <var>dst</var> is a directory, the file will
96be moved into it with the same name; otherwise, <var>src</var> is just renamed
97to <var>dst</var>. Returns the new full name of the file.
98<span class="warning"><b class="label">Warning:</b>
99Handles cross-device moves on Unix using <tt class="function">copy_file()</tt>.
100What about other systems???</span>
101</dl>
102
103<P>
104<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
105 <td><nobr><b><tt id='l2h-77' xml:id='l2h-77' class="function">write_file</tt></b>(</nobr></td>
106 <td><var>filename, contents</var>)</td></tr></table></dt>
107<dd>
108Create a file called <var>filename</var> and write <var>contents</var> (a
109sequence of strings without line terminators) to it.
110</dl>
111
112<P>
113
114<DIV CLASS="navigation">
115<div class='online-navigation'>
116<p></p><hr />
117<table align="center" width="100%" cellpadding="0" cellspacing="2">
118<tr>
119<td class='online-navigation'><a rel="prev" title="10.11 distutils.dir_util "
120 href="module-distutils.dirutil.html"><img src='../icons/previous.png'
121 border='0' height='32' alt='Previous Page' width='32' /></A></td>
122<td class='online-navigation'><a rel="parent" title="10. API Reference"
123 href="api-reference.html"><img src='../icons/up.png'
124 border='0' height='32' alt='Up One Level' width='32' /></A></td>
125<td class='online-navigation'><a rel="next" title="10.13 distutils.util "
126 href="module-distutils.util.html"><img src='../icons/next.png'
127 border='0' height='32' alt='Next Page' width='32' /></A></td>
128<td align="center" width="100%">Distributing Python Modules</td>
129<td class='online-navigation'><img src='../icons/blank.png'
130 border='0' height='32' alt='' width='32' /></td>
131<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
132 border='0' height='32' alt='Module Index' width='32' /></a></td>
133<td class='online-navigation'><a rel="index" title="Index"
134 href="genindex.html"><img src='../icons/index.png'
135 border='0' height='32' alt='Index' width='32' /></A></td>
136</tr></table>
137<div class='online-navigation'>
138<b class="navlabel">Previous:</b>
139<a class="sectref" rel="prev" href="module-distutils.dirutil.html">10.11 distutils.dir_util </A>
140<b class="navlabel">Up:</b>
141<a class="sectref" rel="parent" href="api-reference.html">10. API Reference</A>
142<b class="navlabel">Next:</b>
143<a class="sectref" rel="next" href="module-distutils.util.html">10.13 distutils.util </A>
144</div>
145</div>
146<hr />
147<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
148</DIV>
149<!--End of Navigation Panel-->
150<ADDRESS>
151See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
152</ADDRESS>
153</BODY>
154</HTML>