• Home
  • Raw
  • Download

Lines Matching +full:ignore +full:- +full:errors

1 :mod:`shutil` --- High-level file operations
5 :synopsis: High-level file operations, including copying.
15 --------------
17 The :mod:`shutil` module offers a number of high-level operations on files and
24 Even the higher-level file copying functions (:func:`shutil.copy`,
34 .. _file-operations:
37 ------------------------------
41 Copy the contents of the file-like object *fsrc* to the file-like object *fdst*.
85 Similar to :func:`shutil.copy`, but metadata is copied as well -- in fact,
87 similar to the Unix command :program:`cp -p`.
93 :func:`copytree`\'s *ignore* argument, ignoring files and directories that
94 match one of the glob-style *patterns* provided. See the example below.
99 .. function:: copytree(src, dst, symlinks=False, ignore=None)
112 If *ignore* is given, it must be a callable that will receive as its
115 called recursively, the *ignore* callable will be called once for each
120 ignores names based on glob-style patterns.
136 Added the *ignore* argument to be able to influence what is being copied.
144 symbolic link to a directory). If *ignore_errors* is true, errors resulting
145 from failed removals will be ignored; if false or omitted, such errors are
180 This exception collects exceptions that are raised during a multi-file
181 operation. For :func:`copytree`, the exception argument is a list of 3-tuples
187 .. _copytree-example:
196 def copytree(src, dst, symlinks=False, ignore=None):
198 if ignore is not None:
199 ignored_names = ignore(src, names)
204 errors = []
215 copytree(srcname, dstname, symlinks, ignore)
220 errors.append((srcname, dstname, str(why)))
224 errors.extend(err.args[0])
231 errors.extend((src, dst, str(why)))
232 if errors:
233 raise Error(errors)
239 copytree(source, destination, ignore=ignore_patterns('*.pyc', 'tmp*'))
244 Another example that uses the *ignore* argument to add a logging call::
253 copytree(source, destination, ignore=_logpath)
256 .. _archiving-operations:
259 --------------------
261 High-level utilities to create and read compressed and archived files are also
269 any format-specific extension. *format* is the archive format: one of
300 - *zip*: ZIP file (if the :mod:`zlib` module or external ``zip``
302 - *tar*: uncompressed tar file.
303 - *gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available).
304 - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available).
333 .. _archiving-example:
338 In this example, we create a gzip'ed tar-file archive containing all files
350 .. code-block:: shell-session
352 $ tar -tzvf /Users/tarek/myarchive.tar.gz
353 drwx------ tarek/staff 0 2010-02-01 16:23:40 ./
354 -rw-r--r-- tarek/staff 609 2008-06-09 13:26:54 ./authorized_keys
355 -rwxr-xr-x tarek/staff 65 2008-06-09 13:26:54 ./config
356 -rwx------ tarek/staff 668 2008-06-09 13:26:54 ./id_dsa
357 -rwxr-xr-x tarek/staff 609 2008-06-09 13:26:54 ./id_dsa.pub
358 -rw------- tarek/staff 1675 2008-06-09 13:26:54 ./id_rsa
359 -rw-r--r-- tarek/staff 397 2008-06-09 13:26:54 ./id_rsa.pub
360 -rw-r--r-- tarek/staff 37192 2010-02-06 18:23:10 ./known_hosts