2 :mod:`macostools` --- Convenience routines for file manipulation
3 ================================================================
7 :synopsis: Convenience routines for file manipulation.
11 This module contains some convenience routines for file-manipulation on the
12 Macintosh. All file parameters can be specified as pathnames, :class:`FSRef` or
13 :class:`FSSpec` objects. This module expects a filesystem which supports forked
14 files, so it should not be used on UFS partitions.
18 This module has been removed in Python 3.0.
20 The :mod:`macostools` module defines the following functions:
23 .. function:: copy(src, dst[, createpath[, copytimes]])
25 Copy file *src* to *dst*. If *createpath* is non-zero the folders leading to
26 *dst* are created if necessary. The method copies data and resource fork and
27 some finder information (creator, type, flags) and optionally the creation,
28 modification and backup times (default is to copy them). Custom icons, comments
29 and icon position are not copied.
32 .. function:: copytree(src, dst)
34 Recursively copy a file tree from *src* to *dst*, creating folders as needed.
35 *src* and *dst* should be specified as pathnames.
38 .. function:: mkalias(src, dst)
40 Create a finder alias *dst* pointing to *src*.
43 .. function:: touched(dst)
45 Tell the finder that some bits of finder-information such as creator or type for
46 file *dst* has changed. The file can be specified by pathname or fsspec. This
47 call should tell the finder to redraw the files icon.
50 The function is a no-op on OS X.
55 The buffer size for ``copy``, default 1 megabyte.
57 Note that the process of creating finder aliases is not specified in the Apple
58 documentation. Hence, aliases created with :func:`mkalias` could conceivably
59 have incompatible behaviour in some cases.
62 :mod:`findertools` --- The :program:`finder`'s Apple Events interface
63 =====================================================================
65 .. module:: findertools
67 :synopsis: Wrappers around the finder's Apple Events interface.
70 .. index:: single: AppleEvents
72 This module contains routines that give Python programs access to some
73 functionality provided by the finder. They are implemented as wrappers around
74 the AppleEvent interface to the finder.
76 All file and folder parameters can be specified either as full pathnames, or as
77 :class:`FSRef` or :class:`FSSpec` objects.
79 The :mod:`findertools` module defines the following functions:
82 .. function:: launch(file)
84 Tell the finder to launch *file*. What launching means depends on the file:
85 applications are started, folders are opened and documents are opened in the
89 .. function:: Print(file)
91 Tell the finder to print a file. The behaviour is identical to selecting the
92 file and using the print command in the finder's file menu.
95 .. function:: copy(file, destdir)
97 Tell the finder to copy a file or folder *file* to folder *destdir*. The
98 function returns an :class:`Alias` object pointing to the new file.
101 .. function:: move(file, destdir)
103 Tell the finder to move a file or folder *file* to folder *destdir*. The
104 function returns an :class:`Alias` object pointing to the new file.
107 .. function:: sleep()
109 Tell the finder to put the Macintosh to sleep, if your machine supports it.
112 .. function:: restart()
114 Tell the finder to perform an orderly restart of the machine.
117 .. function:: shutdown()
119 Tell the finder to perform an orderly shutdown of the machine.