blob: 7924669ce0821486a552d2f615e6e231288e5e76 [file] [log] [blame]
Georg Brandl8ec7f652007-08-15 14:28:01 +00001
2:mod:`macostools` --- Convenience routines for file manipulation
3================================================================
4
5.. module:: macostools
6 :platform: Mac
7 :synopsis: Convenience routines for file manipulation.
Benjamin Peterson23681932008-05-12 21:42:13 +00008 :deprecated:
Georg Brandl8ec7f652007-08-15 14:28:01 +00009
10
11This module contains some convenience routines for file-manipulation on the
12Macintosh. All file parameters can be specified as pathnames, :class:`FSRef` or
13:class:`FSSpec` objects. This module expects a filesystem which supports forked
14files, so it should not be used on UFS partitions.
15
Georg Brandlb44c9f32009-04-27 15:29:26 +000016.. note::
Benjamin Peterson23681932008-05-12 21:42:13 +000017
Ezio Melotti510ff542012-05-03 19:21:40 +030018 This module has been removed in Python 3.
Benjamin Peterson23681932008-05-12 21:42:13 +000019
Ronald Oussorenab3f5cb2010-02-07 11:38:28 +000020
21
Georg Brandl8ec7f652007-08-15 14:28:01 +000022The :mod:`macostools` module defines the following functions:
23
24
25.. function:: copy(src, dst[, createpath[, copytimes]])
26
27 Copy file *src* to *dst*. If *createpath* is non-zero the folders leading to
28 *dst* are created if necessary. The method copies data and resource fork and
29 some finder information (creator, type, flags) and optionally the creation,
30 modification and backup times (default is to copy them). Custom icons, comments
31 and icon position are not copied.
32
Ronald Oussorenab3f5cb2010-02-07 11:38:28 +000033 .. note::
34
35 This function does not work in 64-bit code because it uses APIs that
36 are not available in 64-bit mode.
Georg Brandl8ec7f652007-08-15 14:28:01 +000037
38.. function:: copytree(src, dst)
39
40 Recursively copy a file tree from *src* to *dst*, creating folders as needed.
41 *src* and *dst* should be specified as pathnames.
42
Ronald Oussorenab3f5cb2010-02-07 11:38:28 +000043 .. note::
44
45 This function does not work in 64-bit code because it uses APIs that
46 are not available in 64-bit mode.
Georg Brandl8ec7f652007-08-15 14:28:01 +000047
48.. function:: mkalias(src, dst)
49
50 Create a finder alias *dst* pointing to *src*.
51
Ronald Oussorenab3f5cb2010-02-07 11:38:28 +000052 .. note::
53
54 This function does not work in 64-bit code because it uses APIs that
55 are not available in 64-bit mode.
56
Georg Brandl8ec7f652007-08-15 14:28:01 +000057
58.. function:: touched(dst)
59
60 Tell the finder that some bits of finder-information such as creator or type for
61 file *dst* has changed. The file can be specified by pathname or fsspec. This
62 call should tell the finder to redraw the files icon.
63
64 .. deprecated:: 2.6
65 The function is a no-op on OS X.
66
67
68.. data:: BUFSIZ
69
70 The buffer size for ``copy``, default 1 megabyte.
71
72Note that the process of creating finder aliases is not specified in the Apple
73documentation. Hence, aliases created with :func:`mkalias` could conceivably
74have incompatible behaviour in some cases.
75
76
Ezio Melottibe96cf62009-06-30 22:56:16 +000077:mod:`findertools` --- The :program:`finder`'s Apple Events interface
Ezio Melottic2f5a592009-06-30 22:51:06 +000078======================================================================
Georg Brandl8ec7f652007-08-15 14:28:01 +000079
80.. module:: findertools
81 :platform: Mac
82 :synopsis: Wrappers around the finder's Apple Events interface.
83
84
85.. index:: single: AppleEvents
86
87This module contains routines that give Python programs access to some
88functionality provided by the finder. They are implemented as wrappers around
89the AppleEvent interface to the finder.
90
91All file and folder parameters can be specified either as full pathnames, or as
92:class:`FSRef` or :class:`FSSpec` objects.
93
94The :mod:`findertools` module defines the following functions:
95
96
97.. function:: launch(file)
98
99 Tell the finder to launch *file*. What launching means depends on the file:
100 applications are started, folders are opened and documents are opened in the
101 correct application.
102
103
104.. function:: Print(file)
105
106 Tell the finder to print a file. The behaviour is identical to selecting the
107 file and using the print command in the finder's file menu.
108
109
110.. function:: copy(file, destdir)
111
112 Tell the finder to copy a file or folder *file* to folder *destdir*. The
113 function returns an :class:`Alias` object pointing to the new file.
114
115
116.. function:: move(file, destdir)
117
118 Tell the finder to move a file or folder *file* to folder *destdir*. The
119 function returns an :class:`Alias` object pointing to the new file.
120
121
122.. function:: sleep()
123
124 Tell the finder to put the Macintosh to sleep, if your machine supports it.
125
126
127.. function:: restart()
128
129 Tell the finder to perform an orderly restart of the machine.
130
131
132.. function:: shutdown()
133
134 Tell the finder to perform an orderly shutdown of the machine.
135