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