Python file copy mobile Shutil module

Source: Internet
Author: User

Shutil.copyfile (SRC, DST) is copied from source Src to DST. The premise is, of course, that the destination address has writable permissions. The exception information thrown is IOException. If the current DST already exists, it will be overwritten.
Shutil.move (SRC, DST) move files or rename
Shutil.copymode (SRC, DST) just replicates its permissions other things are not copied
Shutil.copystat (SRC, DST) copy permissions, last access time, last modified time
Shutil.copy (SRC, DST) copy a file to a file or a directory
Shutil.copy2 (SRC, DST) copy files on the basis of copy the last access time and modification time are also copied, similar to cp–p things
Shutil.copy2 (SRC, DST) if the file system in two locations is the same, it is equivalent to rename operation, just renaming; if it's not the same filesystem, it's a move operation.
Shutil.copytree (Olddir, Newdir, True/flase)
Copy the Olddir to a newdir, if the 3rd parameter is true, the symbol connection under the folder will be kept when the directory is copied, and if the 3rd parameter is false, a physical copy will be generated in the replicated directory instead of the symbolic connection
Shutil.rmtree (SRC) recursively deletes a directory and all content within the directory

Reprint Http://www.jb51.net/article/50070.htm

Python file copy mobile Shutil module

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.