shutil模块
copy函数
copy(src, dst, *, follow_symlinks=True)
Copy data and mode bits ("cp src dst"). Return the file's destination.
The destination may be a directory.
If follow_symlinks is false, symlinks won't be followed. This
resembles GNU's "cp -P src dst".
If source and destination are the same file, a SameFileError will be
raised.
拷贝一个文件或目录到另一个文件 和权限 如果src 和dst相同,则会抛出异常SameFileError。
返回值是目标文件
copy2函数
copy2(src, dst, *, follow_symlinks=True)
Copy data and all stat info ("cp -p src dst"). Return the file's
destination."
The destination may be a directory.
If follow_symlinks is false, symlinks won't be followed. This
resembles GNU's "cp -P src dst".
在copy的基础上,复制文件的访问时间和修改时间,及文件的状态
copyfile函数
copyfile(src, dst, *, follow_symlinks=True)
Copy data from src to dst.
If follow_symlinks is not set and src is a symbolic link, a new
symlink will be created instead of copying the file it points to.
拷贝文件
copyfileobj函数
功能于copy file函数类似
copymode函数
复制文件的权限
copymode(src, dst, *, follow_symlinks=True)
Copy mode bits from src to dst.
If follow_symlinks is not set, symlinks aren't followed if and only
if both `src` and `dst` are symlinks. If `lchmod` isn't available
(e.g. Linux) this method does nothing.
copystart函数
拷贝文件的状态信息
copytree函数
递归的拷贝文件
remstree函数
递归删除文件
move函数
递归的移动文件