Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / html / python / dist / module-distutils.dirutil.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.fileutil.html" />
12<link rel="prev" href="module-distutils.deputil.html" />
13<link rel="parent" href="api-reference.html" />
14<link rel="next" href="module-distutils.fileutil.html" />
15<meta name='aesop' content='information' />
16<title>10.11 distutils.dir_util -- Directory tree 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.10 distutils.dep_util "
24 href="module-distutils.deputil.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.12 distutils.file_util "
30 href="module-distutils.fileutil.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.deputil.html">10.10 distutils.dep_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.fileutil.html">10.12 distutils.file_util </A>
48</div>
49<hr /></div>
50</DIV>
51<!--End of Navigation Panel-->
52
53<H1><A NAME="SECTION00101100000000000000000">
5410.11 <tt class="module">distutils.dir_util</tt> -- Directory tree operations</A>
55</H1>
56<A NAME="module-distutils.dirutil"></A>
57
58<P>
59This module provides functions for operating on directories and trees
60of directories.
61
62<P>
63<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
64 <td><nobr><b><tt id='l2h-70' xml:id='l2h-70' class="function">mkpath</tt></b>(</nobr></td>
65 <td><var>name</var><big>[</big><var>, mode=<code>0777</code>, verbose=<code>0</code>, dry_run=<code>0</code></var><big>]</big><var></var>)</td></tr></table></dt>
66<dd>
67Create a directory and any missing ancestor directories. If the
68directory already exists (or if <var>name</var> is the empty string, which
69means the current directory, which of course exists), then do
70nothing. Raise <tt class="exception">DistutilsFileError</tt> if unable to create some
71directory along the way (eg. some sub-path exists, but is a file
72rather than a directory). If <var>verbose</var> is true, print a one-line
73summary of each mkdir to stdout. Return the list of directories
74actually created.
75</dl>
76
77<P>
78<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
79 <td><nobr><b><tt id='l2h-71' xml:id='l2h-71' class="function">create_tree</tt></b>(</nobr></td>
80 <td><var>base_dir, files</var><big>[</big><var>, mode=<code>0777</code>, verbose=<code>0</code>, dry_run=<code>0</code></var><big>]</big><var></var>)</td></tr></table></dt>
81<dd>
82Create all the empty directories under <var>base_dir</var> needed to
83put <var>files</var> there. <var>base_dir</var> is just the a name of a directory
84which doesn't necessarily exist yet; <var>files</var> is a list of filenames
85to be interpreted relative to <var>base_dir</var>. <var>base_dir</var> + the
86directory portion of every file in <var>files</var> will be created if it
87doesn't already exist. <var>mode</var>, <var>verbose</var> and <var>dry_run</var> flags
88are as for <tt class="function">mkpath()</tt>.
89</dl>
90
91<P>
92<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
93 <td><nobr><b><tt id='l2h-72' xml:id='l2h-72' class="function">copy_tree</tt></b>(</nobr></td>
94 <td><var>src, dst</var><big>[</big><var>preserve_mode=<code>1</code>, preserve_times=<code>1</code>, preserve_symlinks=<code>0</code>, update=<code>0</code>, verbose=<code>0</code>, dry_run=<code>0</code></var><big>]</big><var></var>)</td></tr></table></dt>
95<dd>
96Copy an entire directory tree <var>src</var> to a new location <var>dst</var>. Both
97<var>src</var> and <var>dst</var> must be directory names. If <var>src</var> is not a
98directory, raise <tt class="exception">DistutilsFileError</tt>. If <var>dst</var> does
99not exist, it is created with <tt class="function">mkpath()</tt>. The end result of the
100copy is that every file in <var>src</var> is copied to <var>dst</var>, and
101directories under <var>src</var> are recursively copied to <var>dst</var>.
102Return the list of files that were copied or might have been copied,
103using their output name. The return value is unaffected by <var>update</var>
104or <var>dry_run</var>: it is simply the list of all files under <var>src</var>,
105with the names changed to be under <var>dst</var>.
106
107<P>
108<var>preserve_mode</var> and <var>preserve_times</var> are the same as for
109<tt class="function">copy_file</tt> in <tt class="module"><a href="module-distutils.fileutil.html">distutils.file_util</a></tt>;
110note that they only apply to regular files, not to directories. If
111<var>preserve_symlinks</var> is true, symlinks will be copied as symlinks
112(on platforms that support them!); otherwise (the default), the
113destination of the symlink will be copied. <var>update</var> and
114<var>verbose</var> are the same as for
115<tt class="function">copy_file()</tt>.
116</dl>
117
118<P>
119<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
120 <td><nobr><b><tt id='l2h-73' xml:id='l2h-73' class="function">remove_tree</tt></b>(</nobr></td>
121 <td><var>directory</var><big>[</big><var>verbose=<code>0</code>, dry_run=<code>0</code></var><big>]</big><var></var>)</td></tr></table></dt>
122<dd>
123Recursively remove <var>directory</var> and all files and directories underneath
124it. Any errors are ignored (apart from being reported to <code>sys.stdout</code> if
125<var>verbose</var> is true).
126</dl>
127
128<P>
129<b class="du-xxx">Some of this could be replaced with the shutil module?</b>
130
131<P>
132
133<DIV CLASS="navigation">
134<div class='online-navigation'>
135<p></p><hr />
136<table align="center" width="100%" cellpadding="0" cellspacing="2">
137<tr>
138<td class='online-navigation'><a rel="prev" title="10.10 distutils.dep_util "
139 href="module-distutils.deputil.html"><img src='../icons/previous.png'
140 border='0' height='32' alt='Previous Page' width='32' /></A></td>
141<td class='online-navigation'><a rel="parent" title="10. API Reference"
142 href="api-reference.html"><img src='../icons/up.png'
143 border='0' height='32' alt='Up One Level' width='32' /></A></td>
144<td class='online-navigation'><a rel="next" title="10.12 distutils.file_util "
145 href="module-distutils.fileutil.html"><img src='../icons/next.png'
146 border='0' height='32' alt='Next Page' width='32' /></A></td>
147<td align="center" width="100%">Distributing Python Modules</td>
148<td class='online-navigation'><img src='../icons/blank.png'
149 border='0' height='32' alt='' width='32' /></td>
150<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
151 border='0' height='32' alt='Module Index' width='32' /></a></td>
152<td class='online-navigation'><a rel="index" title="Index"
153 href="genindex.html"><img src='../icons/index.png'
154 border='0' height='32' alt='Index' width='32' /></A></td>
155</tr></table>
156<div class='online-navigation'>
157<b class="navlabel">Previous:</b>
158<a class="sectref" rel="prev" href="module-distutils.deputil.html">10.10 distutils.dep_util </A>
159<b class="navlabel">Up:</b>
160<a class="sectref" rel="parent" href="api-reference.html">10. API Reference</A>
161<b class="navlabel">Next:</b>
162<a class="sectref" rel="next" href="module-distutils.fileutil.html">10.12 distutils.file_util </A>
163</div>
164</div>
165<hr />
166<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
167</DIV>
168<!--End of Navigation Panel-->
169<ADDRESS>
170See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
171</ADDRESS>
172</BODY>
173</HTML>