| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="mac.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="mac.html" title='Macintosh Library Modules' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="module-findertools.html" /> |
| 13 | <link rel="prev" href="module-MacOS.html" /> |
| 14 | <link rel="parent" href="macpython-modules.html" /> |
| 15 | <link rel="next" href="module-findertools.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>2.5 macostools -- Convenience routines for file manipulation</title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="2.4 MacOS " |
| 25 | href="module-MacOS.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="2. MacPython Modules" |
| 28 | href="macpython-modules.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="2.6 findertools " |
| 31 | href="module-findertools.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Macintosh Library Modules</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 38 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="module-MacOS.html">2.4 MacOS </A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="macpython-modules.html">2. MacPython Modules</A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="module-findertools.html">2.6 findertools </A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H1><A NAME="SECTION004500000000000000000"> |
| 56 | 2.5 <tt class="module">macostools</tt> -- |
| 57 | Convenience routines for file manipulation</A> |
| 58 | </H1> |
| 59 | |
| 60 | <P> |
| 61 | <A NAME="module-macostools"></A> |
| 62 | <p class="availability">Availability: <span |
| 63 | class="platform">Macintosh</span>.</p> |
| 64 | |
| 65 | <P> |
| 66 | This module contains some convenience routines for file-manipulation |
| 67 | on the Macintosh. All file parameters can be specified as |
| 68 | pathnames, <tt class="class">FSRef</tt> or <tt class="class">FSSpec</tt> objects. This module |
| 69 | expects a filesystem which supports forked files, so it should not |
| 70 | be used on UFS partitions. |
| 71 | |
| 72 | <P> |
| 73 | The <tt class="module">macostools</tt> module defines the following functions: |
| 74 | |
| 75 | <P> |
| 76 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 77 | <td><nobr><b><tt id='l2h-66' xml:id='l2h-66' class="function">copy</tt></b>(</nobr></td> |
| 78 | <td><var>src, dst</var><big>[</big><var>, createpath</var><big>[</big><var>, copytimes</var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt> |
| 79 | <dd> |
| 80 | Copy file <var>src</var> to <var>dst</var>. If <var>createpath</var> is non-zero |
| 81 | the folders leading to <var>dst</var> are created if necessary. |
| 82 | The method copies data and |
| 83 | resource fork and some finder information (creator, type, flags) and |
| 84 | optionally the creation, modification and backup times (default is to |
| 85 | copy them). Custom icons, comments and icon position are not copied. |
| 86 | </dl> |
| 87 | |
| 88 | <P> |
| 89 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 90 | <td><nobr><b><tt id='l2h-67' xml:id='l2h-67' class="function">copytree</tt></b>(</nobr></td> |
| 91 | <td><var>src, dst</var>)</td></tr></table></dt> |
| 92 | <dd> |
| 93 | Recursively copy a file tree from <var>src</var> to <var>dst</var>, creating |
| 94 | folders as needed. <var>src</var> and <var>dst</var> should be specified as |
| 95 | pathnames. |
| 96 | </dl> |
| 97 | |
| 98 | <P> |
| 99 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 100 | <td><nobr><b><tt id='l2h-68' xml:id='l2h-68' class="function">mkalias</tt></b>(</nobr></td> |
| 101 | <td><var>src, dst</var>)</td></tr></table></dt> |
| 102 | <dd> |
| 103 | Create a finder alias <var>dst</var> pointing to <var>src</var>. |
| 104 | </dl> |
| 105 | |
| 106 | <P> |
| 107 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 108 | <td><nobr><b><tt id='l2h-69' xml:id='l2h-69' class="function">touched</tt></b>(</nobr></td> |
| 109 | <td><var>dst</var>)</td></tr></table></dt> |
| 110 | <dd> |
| 111 | Tell the finder that some bits of finder-information such as creator |
| 112 | or type for file <var>dst</var> has changed. The file can be specified by |
| 113 | pathname or fsspec. This call should tell the finder to redraw the |
| 114 | files icon. |
| 115 | </dl> |
| 116 | |
| 117 | <P> |
| 118 | <dl><dt><b><tt id='l2h-70' xml:id='l2h-70'>BUFSIZ</tt></b></dt> |
| 119 | <dd> |
| 120 | The buffer size for <code>copy</code>, default 1 megabyte. |
| 121 | </dd></dl> |
| 122 | |
| 123 | <P> |
| 124 | Note that the process of creating finder aliases is not specified in |
| 125 | the Apple documentation. Hence, aliases created with <tt class="function">mkalias()</tt> |
| 126 | could conceivably have incompatible behaviour in some cases. |
| 127 | |
| 128 | <P> |
| 129 | |
| 130 | <DIV CLASS="navigation"> |
| 131 | <div class='online-navigation'> |
| 132 | <p></p><hr /> |
| 133 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 134 | <tr> |
| 135 | <td class='online-navigation'><a rel="prev" title="2.4 MacOS " |
| 136 | href="module-MacOS.html"><img src='../icons/previous.png' |
| 137 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 138 | <td class='online-navigation'><a rel="parent" title="2. MacPython Modules" |
| 139 | href="macpython-modules.html"><img src='../icons/up.png' |
| 140 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 141 | <td class='online-navigation'><a rel="next" title="2.6 findertools " |
| 142 | href="module-findertools.html"><img src='../icons/next.png' |
| 143 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 144 | <td align="center" width="100%">Macintosh Library Modules</td> |
| 145 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 146 | href="contents.html"><img src='../icons/contents.png' |
| 147 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 148 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 149 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 150 | <td class='online-navigation'><a rel="index" title="Index" |
| 151 | href="genindex.html"><img src='../icons/index.png' |
| 152 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 153 | </tr></table> |
| 154 | <div class='online-navigation'> |
| 155 | <b class="navlabel">Previous:</b> |
| 156 | <a class="sectref" rel="prev" href="module-MacOS.html">2.4 MacOS </A> |
| 157 | <b class="navlabel">Up:</b> |
| 158 | <a class="sectref" rel="parent" href="macpython-modules.html">2. MacPython Modules</A> |
| 159 | <b class="navlabel">Next:</b> |
| 160 | <a class="sectref" rel="next" href="module-findertools.html">2.6 findertools </A> |
| 161 | </div> |
| 162 | </div> |
| 163 | <hr /> |
| 164 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 165 | </DIV> |
| 166 | <!--End of Navigation Panel--> |
| 167 | <ADDRESS> |
| 168 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 169 | </ADDRESS> |
| 170 | </BODY> |
| 171 | </HTML> |