Lines Matching +full:fast +full:- +full:glob
1 :mod:`shutil` --- High-level file operations
5 :synopsis: High-level file operations, including copying.
16 --------------
18 The :mod:`shutil` module offers a number of high-level operations on files and
25 Even the higher-level file copying functions (:func:`shutil.copy`,
35 .. _file-operations:
38 ------------------------------
42 Copy the contents of the file-like object *fsrc* to the file-like object *fdst*.
55 *src* and *dst* are path-like objects or path names given as strings.
70 .. audit-event:: shutil.copyfile src,dst shutil.copyfile
82 Platform-specific fast-copy syscalls may be used internally in order to
84 :ref:`shutil-platform-dependent-efficient-copy-operations` section.
97 group are unaffected. *src* and *dst* are path-like objects or path names
106 .. audit-event:: shutil.copymode src,dst shutil.copymode
116 group are unaffected. *src* and *dst* are path-like objects or path
153 .. audit-event:: shutil.copystat src,dst shutil.copystat
161 should be :term:`path-like objects <path-like object>` or strings. If
177 .. audit-event:: shutil.copyfile src,dst shutil.copy
179 .. audit-event:: shutil.copymode src,dst shutil.copy
186 Platform-specific fast-copy syscalls may be used internally in order to
188 :ref:`shutil-platform-dependent-efficient-copy-operations` section.
208 .. audit-event:: shutil.copyfile src,dst shutil.copy2
210 .. audit-event:: shutil.copystat src,dst shutil.copy2
218 Platform-specific fast-copy syscalls may be used internally in order to
220 :ref:`shutil-platform-dependent-efficient-copy-operations` section.
226 match one of the glob-style *patterns* provided. See the example below.
260 ignores names based on glob-style patterns.
275 .. audit-event:: shutil.copytree src,dst shutil.copytree
288 Platform-specific fast-copy syscalls may be used internally in order to
290 :ref:`shutil-platform-dependent-efficient-copy-operations` section.
310 On platforms that support the necessary fd-based functions a symlink
327 .. audit-event:: shutil.rmtree path,dir_fd shutil.rmtree
331 if platform supports fd-based functions.
344 only true for platforms supporting fd-based directory access functions.
371 .. audit-event:: shutil.move src,dst shutil.move
382 Platform-specific fast-copy syscalls may be used internally in order to
384 :ref:`shutil-platform-dependent-efficient-copy-operations` section.
387 Accepts a :term:`path-like object` for both *src* and *dst*.
412 .. audit-event:: shutil.chown path,user,group shutil.chown
449 This exception collects exceptions that are raised during a multi-file
450 operation. For :func:`copytree`, the exception argument is a list of 3-tuples
453 .. _shutil-platform-dependent-efficient-copy-operations:
455 Platform-dependent efficient copy operations
461 platform-specific "fast-copy" syscalls in order to copy the file more
463 "fast-copy" means that the copying operation occurs within the kernel, avoiding
471 instead of 64 KiB) and a :func:`memoryview`-based variant of
474 If the fast-copy operation fails and no data was written in the destination
480 .. _shutil-copytree-example:
506 .. _shutil-rmtree-example:
512 of the files have their read-only bit set. It uses the onerror callback
526 .. _archiving-operations:
529 --------------------
537 High-level utilities to create and read compressed and archived files are also
545 any format-specific extension. *format* is the archive format: one of
557 to *root_dir*. See :ref:`shutil-archiving-example-with-basedir` for how to
573 .. audit-event:: shutil.make_archive base_name,format,root_dir,base_dir shutil.make_archive
577 This function is not thread-safe when custom archivers registered
583 The modern pax (POSIX.1-2001) format is now used instead of
587 This function is now made thread-safe during creation of standard
597 - *zip*: ZIP file (if the :mod:`zlib` module is available).
598 - *tar*: Uncompressed tar file. Uses POSIX.1-2001 pax format for new archives.
599 - *gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available).
600 - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available).
601 - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available).
643 The keyword-only *filter* argument, which was added in Python 3.11.4,
647 unless using features specific to tar and UNIX-like filesystems.
648 (See :ref:`tarfile-extraction-filter` for details.)
652 .. audit-event:: shutil.unpack_archive filename,extract_dir,format shutil.unpack_archive
662 Accepts a :term:`path-like object` for *filename* and *extract_dir*.
676 - the path of the archive, as a positional argument;
677 - the directory the archive must be extracted to, as a positional argument;
678 - possibly a *filter* keyword argument, if it was given to
680 - additional keyword arguments, specified by *extra_args* as a sequence
700 - *zip*: ZIP file (unpacking compressed files works only if the corresponding
702 - *tar*: uncompressed tar file.
703 - *gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available).
704 - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available).
705 - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available).
711 .. _shutil-archiving-example:
716 In this example, we create a gzip'ed tar-file archive containing all files
728 .. code-block:: shell-session
730 $ tar -tzvf /Users/tarek/myarchive.tar.gz
731 drwx------ tarek/staff 0 2010-02-01 16:23:40 ./
732 -rw-r--r-- tarek/staff 609 2008-06-09 13:26:54 ./authorized_keys
733 -rwxr-xr-x tarek/staff 65 2008-06-09 13:26:54 ./config
734 -rwx------ tarek/staff 668 2008-06-09 13:26:54 ./id_dsa
735 -rwxr-xr-x tarek/staff 609 2008-06-09 13:26:54 ./id_dsa.pub
736 -rw------- tarek/staff 1675 2008-06-09 13:26:54 ./id_rsa
737 -rw-r--r-- tarek/staff 397 2008-06-09 13:26:54 ./id_rsa.pub
738 -rw-r--r-- tarek/staff 37192 2010-02-06 18:23:10 ./known_hosts
741 .. _shutil-archiving-example-with-basedir:
746 In this example, similar to the `one above <shutil-archiving-example_>`_,
750 .. code-block:: shell-session
776 .. code-block:: shell-session
778 $ python -m tarfile -l /Users/tarek/myarchive.tar
784 ----------------------------------------