Lines Matching +full:symbolic +full:- +full:ref

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.
66 If *follow_symlinks* is false and *src* is a symbolic link,
67 a new symbolic link will be created instead of copying the
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
99 If *follow_symlinks* is false, and both *src* and *dst* are symbolic links,
103 :func:`copymode` cannot modify symbolic links on the local platform, and it
106 .. audit-event:: shutil.copymode src,dst shutil.copymode
116 group are unaffected. *src* and *dst* are path-like objects or path
120 refer to symbolic links, :func:`copystat` will operate on
121 the symbolic links themselves rather than the files the
122 symbolic links refer to—reading the information from the
123 *src* symbolic link, and writing the information to the
124 *dst* symbolic link.
129 modify symbolic links. Python itself can tell you what
134 bits of a symbolic link.
138 and modification times of a symbolic link.
142 a symbolic link. (``os.chflags`` is not available on
146 is unavailable, when asked to modify a symbolic link,
153 .. audit-event:: shutil.copystat src,dst shutil.copystat
161 should be :term:`path-like objects <path-like object>` or strings. If
165 If *follow_symlinks* is false, and *src* is a symbolic link,
166 *dst* will be created as a symbolic link. If *follow_symlinks*
167 is true and *src* is a symbolic link, *dst* will be a copy of
176 .. audit-event:: shutil.copyfile src,dst shutil.copy
178 .. audit-event:: shutil.copymode src,dst shutil.copy
185 Platform-specific fast-copy syscalls may be used internally in order to
187 :ref:`shutil-platform-dependent-efficient-copy-operations` section.
194 When *follow_symlinks* is false, and *src* is a symbolic
196 *src* symbolic link to the newly-created *dst* symbolic link.
205 about platform support for modifying symbolic link metadata.
207 .. audit-event:: shutil.copyfile src,dst shutil.copy2
209 .. audit-event:: shutil.copystat src,dst shutil.copy2
217 Platform-specific fast-copy syscalls may be used internally in order to
219 :ref:`shutil-platform-dependent-efficient-copy-operations` section.
225 match one of the glob-style *patterns* provided. See the example below.
240 If *symlinks* is true, symbolic links in the source tree are represented as
241 symbolic links in the new tree and the metadata of the original links will
260 ignores names based on glob-style patterns.
269 .. audit-event:: shutil.copytree src,dst shutil.copytree
282 Platform-specific fast-copy syscalls may be used internally in order to
284 :ref:`shutil-platform-dependent-efficient-copy-operations` section.
294 symbolic link to a directory). If *ignore_errors* is true, errors resulting
301 On platforms that support the necessary fd-based functions a symlink
318 .. audit-event:: shutil.rmtree path shutil.rmtree
322 if platform supports fd-based functions.
332 only true for platforms supporting fd-based directory access functions.
359 .. audit-event:: shutil.move src,dst shutil.move
370 Platform-specific fast-copy syscalls may be used internally in order to
372 :ref:`shutil-platform-dependent-efficient-copy-operations` section.
375 Accepts a :term:`path-like object` for both *src* and *dst*.
400 .. audit-event:: shutil.chown path,user,group shutil.chown
437 This exception collects exceptions that are raised during a multi-file
438 operation. For :func:`copytree`, the exception argument is a list of 3-tuples
441 .. _shutil-platform-dependent-efficient-copy-operations:
443 Platform-dependent efficient copy operations
448 platform-specific "fast-copy" syscalls in order to copy the file more
450 "fast-copy" means that the copying operation occurs within the kernel, avoiding
458 instead of 64 KiB) and a :func:`memoryview`-based variant of
461 If the fast-copy operation fails and no data was written in the destination
467 .. _shutil-copytree-example:
528 .. _shutil-rmtree-example:
534 of the files have their read-only bit set. It uses the onerror callback
548 .. _archiving-operations:
551 --------------------
559 High-level utilities to create and read compressed and archived files are also
567 any format-specific extension. *format* is the archive format: one of
579 to *root_dir*. See :ref:`shutil-archiving-example-with-basedir` for how to
595 .. audit-event:: shutil.make_archive base_name,format,root_dir,base_dir shutil.make_archive
598 The modern pax (POSIX.1-2001) format is now used instead of
609 - *zip*: ZIP file (if the :mod:`zlib` module is available).
610 - *tar*: Uncompressed tar file. Uses POSIX.1-2001 pax format for new archives.
611 - *gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available).
612 - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available).
613 - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available).
655 .. audit-event:: shutil.unpack_archive filename,extract_dir,format shutil.unpack_archive
658 Accepts a :term:`path-like object` for *filename* and *extract_dir*.
691 - *zip*: ZIP file (unpacking compressed files works only if the corresponding
693 - *tar*: uncompressed tar file.
694 - *gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available).
695 - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available).
696 - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available).
702 .. _shutil-archiving-example:
707 In this example, we create a gzip'ed tar-file archive containing all files
719 .. code-block:: shell-session
721 $ tar -tzvf /Users/tarek/myarchive.tar.gz
722 drwx------ tarek/staff 0 2010-02-01 16:23:40 ./
723 -rw-r--r-- tarek/staff 609 2008-06-09 13:26:54 ./authorized_keys
724 -rwxr-xr-x tarek/staff 65 2008-06-09 13:26:54 ./config
725 -rwx------ tarek/staff 668 2008-06-09 13:26:54 ./id_dsa
726 -rwxr-xr-x tarek/staff 609 2008-06-09 13:26:54 ./id_dsa.pub
727 -rw------- tarek/staff 1675 2008-06-09 13:26:54 ./id_rsa
728 -rw-r--r-- tarek/staff 397 2008-06-09 13:26:54 ./id_rsa.pub
729 -rw-r--r-- tarek/staff 37192 2010-02-06 18:23:10 ./known_hosts
732 .. _shutil-archiving-example-with-basedir:
737 In this example, similar to the `one above <shutil-archiving-example_>`_,
741 .. code-block:: shell-session
767 .. code-block:: shell-session
769 $ python -m tarfile -l /Users/tarek/myarchive.tar
775 ----------------------------------------