1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
<html xmlns="http://www.w3.org/1999/xhtml">
7
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
<title>37.3. macostools — Convenience routines for file manipulation — Python 2.7.12 documentation</title>
11
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
12
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
14
<script type="text/javascript">
15
var DOCUMENTATION_OPTIONS = {
18
COLLAPSE_INDEX: false,
23
<script type="text/javascript" src="../_static/jquery.js"></script>
24
<script type="text/javascript" src="../_static/underscore.js"></script>
25
<script type="text/javascript" src="../_static/doctools.js"></script>
26
<script type="text/javascript" src="../_static/sidebar.js"></script>
27
<link rel="search" type="application/opensearchdescription+xml"
28
title="Search within Python 2.7.12 documentation"
29
href="../_static/opensearch.xml"/>
30
<link rel="author" title="About these documents" href="../about.html" />
31
<link rel="copyright" title="Copyright" href="../copyright.html" />
32
<link rel="top" title="Python 2.7.12 documentation" href="../contents.html" />
33
<link rel="up" title="37. Mac OS X specific services" href="mac.html" />
34
<link rel="next" title="37.5. EasyDialogs — Basic Macintosh dialogs" href="easydialogs.html" />
35
<link rel="prev" title="37.2. MacOS — Access to Mac OS interpreter features" href="macos.html" />
36
<link rel="shortcut icon" type="image/png" href="../_static/py.png" />
37
<script type="text/javascript" src="../_static/copybutton.js"></script>
38
<script type="text/javascript" src="../_static/version_switch.js"></script>
43
<body role="document">
44
<div class="related" role="navigation" aria-label="related navigation">
47
<li class="right" style="margin-right: 10px">
48
<a href="../genindex.html" title="General Index"
49
accesskey="I">index</a></li>
51
<a href="../py-modindex.html" title="Python Module Index"
54
<a href="easydialogs.html" title="37.5. EasyDialogs — Basic Macintosh dialogs"
55
accesskey="N">next</a> |</li>
57
<a href="macos.html" title="37.2. MacOS — Access to Mac OS interpreter features"
58
accesskey="P">previous</a> |</li>
59
<li><img src="../_static/py.png" alt=""
60
style="vertical-align: middle; margin-top: -1px"/></li>
61
<li><a href="https://www.python.org/">Python</a> »</li>
63
<span class="version_switcher_placeholder">2.7.12</span>
64
<a href="../index.html">Documentation</a> »
67
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>
68
<li class="nav-item nav-item-2"><a href="mac.html" accesskey="U">37. Mac OS X specific services</a> »</li>
72
<div class="document">
73
<div class="documentwrapper">
74
<div class="bodywrapper">
75
<div class="body" role="main">
77
<div class="section" id="module-macostools">
78
<span id="macostools-convenience-routines-for-file-manipulation"></span><h1>37.3. <a class="reference internal" href="#module-macostools" title="macostools: Convenience routines for file manipulation. (deprecated) (Mac)"><code class="xref py py-mod docutils literal"><span class="pre">macostools</span></code></a> — Convenience routines for file manipulation<a class="headerlink" href="#module-macostools" title="Permalink to this headline">¶</a></h1>
79
<p>This module contains some convenience routines for file-manipulation on the
80
Macintosh. All file parameters can be specified as pathnames, <code class="xref py py-class docutils literal"><span class="pre">FSRef</span></code> or
81
<code class="xref py py-class docutils literal"><span class="pre">FSSpec</span></code> objects. This module expects a filesystem which supports forked
82
files, so it should not be used on UFS partitions.</p>
83
<div class="admonition note">
84
<p class="first admonition-title">Note</p>
85
<p class="last">This module has been removed in Python 3.</p>
87
<p>The <a class="reference internal" href="#module-macostools" title="macostools: Convenience routines for file manipulation. (deprecated) (Mac)"><code class="xref py py-mod docutils literal"><span class="pre">macostools</span></code></a> module defines the following functions:</p>
89
<dt id="macostools.copy">
90
<code class="descclassname">macostools.</code><code class="descname">copy</code><span class="sig-paren">(</span><em>src</em>, <em>dst</em><span class="optional">[</span>, <em>createpath</em><span class="optional">[</span>, <em>copytimes</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#macostools.copy" title="Permalink to this definition">¶</a></dt>
91
<dd><p>Copy file <em>src</em> to <em>dst</em>. If <em>createpath</em> is non-zero the folders leading to
92
<em>dst</em> are created if necessary. The method copies data and resource fork and
93
some finder information (creator, type, flags) and optionally the creation,
94
modification and backup times (default is to copy them). Custom icons, comments
95
and icon position are not copied.</p>
96
<div class="admonition note">
97
<p class="first admonition-title">Note</p>
98
<p class="last">This function does not work in 64-bit code because it uses APIs that
99
are not available in 64-bit mode.</p>
103
<dl class="function">
104
<dt id="macostools.copytree">
105
<code class="descclassname">macostools.</code><code class="descname">copytree</code><span class="sig-paren">(</span><em>src</em>, <em>dst</em><span class="sig-paren">)</span><a class="headerlink" href="#macostools.copytree" title="Permalink to this definition">¶</a></dt>
106
<dd><p>Recursively copy a file tree from <em>src</em> to <em>dst</em>, creating folders as needed.
107
<em>src</em> and <em>dst</em> should be specified as pathnames.</p>
108
<div class="admonition note">
109
<p class="first admonition-title">Note</p>
110
<p class="last">This function does not work in 64-bit code because it uses APIs that
111
are not available in 64-bit mode.</p>
115
<dl class="function">
116
<dt id="macostools.mkalias">
117
<code class="descclassname">macostools.</code><code class="descname">mkalias</code><span class="sig-paren">(</span><em>src</em>, <em>dst</em><span class="sig-paren">)</span><a class="headerlink" href="#macostools.mkalias" title="Permalink to this definition">¶</a></dt>
118
<dd><p>Create a finder alias <em>dst</em> pointing to <em>src</em>.</p>
119
<div class="admonition note">
120
<p class="first admonition-title">Note</p>
121
<p class="last">This function does not work in 64-bit code because it uses APIs that
122
are not available in 64-bit mode.</p>
126
<dl class="function">
127
<dt id="macostools.touched">
128
<code class="descclassname">macostools.</code><code class="descname">touched</code><span class="sig-paren">(</span><em>dst</em><span class="sig-paren">)</span><a class="headerlink" href="#macostools.touched" title="Permalink to this definition">¶</a></dt>
129
<dd><p>Tell the finder that some bits of finder-information such as creator or type for
130
file <em>dst</em> has changed. The file can be specified by pathname or fsspec. This
131
call should tell the finder to redraw the files icon.</p>
132
<div class="deprecated">
133
<p><span class="versionmodified">Deprecated since version 2.6: </span>The function is a no-op on OS X.</p>
138
<dt id="macostools.BUFSIZ">
139
<code class="descclassname">macostools.</code><code class="descname">BUFSIZ</code><a class="headerlink" href="#macostools.BUFSIZ" title="Permalink to this definition">¶</a></dt>
140
<dd><p>The buffer size for <code class="docutils literal"><span class="pre">copy</span></code>, default 1 megabyte.</p>
143
<p>Note that the process of creating finder aliases is not specified in the Apple
144
documentation. Hence, aliases created with <a class="reference internal" href="#macostools.mkalias" title="macostools.mkalias"><code class="xref py py-func docutils literal"><span class="pre">mkalias()</span></code></a> could conceivably
145
have incompatible behaviour in some cases.</p>
147
<div class="section" id="module-findertools">
148
<span id="findertools-the-finder-s-apple-events-interface"></span><h1>37.4. <a class="reference internal" href="#module-findertools" title="findertools: Wrappers around the finder's Apple Events interface. (Mac)"><code class="xref py py-mod docutils literal"><span class="pre">findertools</span></code></a> — The <strong class="program">finder</strong>‘s Apple Events interface<a class="headerlink" href="#module-findertools" title="Permalink to this headline">¶</a></h1>
149
<p id="index-0">This module contains routines that give Python programs access to some
150
functionality provided by the finder. They are implemented as wrappers around
151
the AppleEvent interface to the finder.</p>
152
<p>All file and folder parameters can be specified either as full pathnames, or as
153
<code class="xref py py-class docutils literal"><span class="pre">FSRef</span></code> or <code class="xref py py-class docutils literal"><span class="pre">FSSpec</span></code> objects.</p>
154
<p>The <a class="reference internal" href="#module-findertools" title="findertools: Wrappers around the finder's Apple Events interface. (Mac)"><code class="xref py py-mod docutils literal"><span class="pre">findertools</span></code></a> module defines the following functions:</p>
155
<dl class="function">
156
<dt id="findertools.launch">
157
<code class="descclassname">findertools.</code><code class="descname">launch</code><span class="sig-paren">(</span><em>file</em><span class="sig-paren">)</span><a class="headerlink" href="#findertools.launch" title="Permalink to this definition">¶</a></dt>
158
<dd><p>Tell the finder to launch <em>file</em>. What launching means depends on the file:
159
applications are started, folders are opened and documents are opened in the
160
correct application.</p>
163
<dl class="function">
164
<dt id="findertools.Print">
165
<code class="descclassname">findertools.</code><code class="descname">Print</code><span class="sig-paren">(</span><em>file</em><span class="sig-paren">)</span><a class="headerlink" href="#findertools.Print" title="Permalink to this definition">¶</a></dt>
166
<dd><p>Tell the finder to print a file. The behaviour is identical to selecting the
167
file and using the print command in the finder’s file menu.</p>
170
<dl class="function">
171
<dt id="findertools.copy">
172
<code class="descclassname">findertools.</code><code class="descname">copy</code><span class="sig-paren">(</span><em>file</em>, <em>destdir</em><span class="sig-paren">)</span><a class="headerlink" href="#findertools.copy" title="Permalink to this definition">¶</a></dt>
173
<dd><p>Tell the finder to copy a file or folder <em>file</em> to folder <em>destdir</em>. The
174
function returns an <code class="xref py py-class docutils literal"><span class="pre">Alias</span></code> object pointing to the new file.</p>
177
<dl class="function">
178
<dt id="findertools.move">
179
<code class="descclassname">findertools.</code><code class="descname">move</code><span class="sig-paren">(</span><em>file</em>, <em>destdir</em><span class="sig-paren">)</span><a class="headerlink" href="#findertools.move" title="Permalink to this definition">¶</a></dt>
180
<dd><p>Tell the finder to move a file or folder <em>file</em> to folder <em>destdir</em>. The
181
function returns an <code class="xref py py-class docutils literal"><span class="pre">Alias</span></code> object pointing to the new file.</p>
184
<dl class="function">
185
<dt id="findertools.sleep">
186
<code class="descclassname">findertools.</code><code class="descname">sleep</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#findertools.sleep" title="Permalink to this definition">¶</a></dt>
187
<dd><p>Tell the finder to put the Macintosh to sleep, if your machine supports it.</p>
190
<dl class="function">
191
<dt id="findertools.restart">
192
<code class="descclassname">findertools.</code><code class="descname">restart</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#findertools.restart" title="Permalink to this definition">¶</a></dt>
193
<dd><p>Tell the finder to perform an orderly restart of the machine.</p>
196
<dl class="function">
197
<dt id="findertools.shutdown">
198
<code class="descclassname">findertools.</code><code class="descname">shutdown</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#findertools.shutdown" title="Permalink to this definition">¶</a></dt>
199
<dd><p>Tell the finder to perform an orderly shutdown of the machine.</p>
208
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
209
<div class="sphinxsidebarwrapper">
210
<h3><a href="../contents.html">Table Of Contents</a></h3>
212
<li><a class="reference internal" href="#">37.3. <code class="docutils literal"><span class="pre">macostools</span></code> — Convenience routines for file manipulation</a></li>
213
<li><a class="reference internal" href="#module-findertools">37.4. <code class="docutils literal"><span class="pre">findertools</span></code> — The <strong class="program">finder</strong>‘s Apple Events interface</a></li>
216
<h4>Previous topic</h4>
217
<p class="topless"><a href="macos.html"
218
title="previous chapter">37.2. <code class="docutils literal"><span class="pre">MacOS</span></code> — Access to Mac OS interpreter features</a></p>
220
<p class="topless"><a href="easydialogs.html"
221
title="next chapter">37.5. <code class="docutils literal"><span class="pre">EasyDialogs</span></code> — Basic Macintosh dialogs</a></p>
223
<ul class="this-page-menu">
224
<li><a href="../bugs.html">Report a Bug</a></li>
225
<li><a href="../_sources/library/macostools.txt"
226
rel="nofollow">Show Source</a></li>
229
<div id="searchbox" style="display: none" role="search">
230
<h3>Quick search</h3>
231
<form class="search" action="../search.html" method="get">
232
<input type="text" name="q" />
233
<input type="submit" value="Go" />
234
<input type="hidden" name="check_keywords" value="yes" />
235
<input type="hidden" name="area" value="default" />
237
<p class="searchtip" style="font-size: 90%">
238
Enter search terms or a module, class or function name.
241
<script type="text/javascript">$('#searchbox').show(0);</script>
244
<div class="clearer"></div>
246
<div class="related" role="navigation" aria-label="related navigation">
249
<li class="right" style="margin-right: 10px">
250
<a href="../genindex.html" title="General Index"
253
<a href="../py-modindex.html" title="Python Module Index"
256
<a href="easydialogs.html" title="37.5. EasyDialogs — Basic Macintosh dialogs"
259
<a href="macos.html" title="37.2. MacOS — Access to Mac OS interpreter features"
261
<li><img src="../_static/py.png" alt=""
262
style="vertical-align: middle; margin-top: -1px"/></li>
263
<li><a href="https://www.python.org/">Python</a> »</li>
265
<span class="version_switcher_placeholder">2.7.12</span>
266
<a href="../index.html">Documentation</a> »
269
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>
270
<li class="nav-item nav-item-2"><a href="mac.html" >37. Mac OS X specific services</a> »</li>
274
© <a href="../copyright.html">Copyright</a> 1990-2016, Python Software Foundation.
276
The Python Software Foundation is a non-profit corporation.
277
<a href="https://www.python.org/psf/donations/">Please donate.</a>
279
Last updated on Sep 20, 2016.
280
<a href="../bugs.html">Found a bug</a>?
282
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.3.
b'\\ No newline at end of file'