zoukankan      html  css  js  c++  java
  • python copy file

    <code>import shutil
    shutil.copy2('/dir/file.ext', '/new/dir/newname.ext')
    </code>

    or

    <code>shutil.copy2('/dir/file.ext', '/new/dir')
    </code>

    copy2 is also often useful, it preserves the original modification and access info (mtime and atime) in the file metadata.

      49 down vote accepted

    shutil has many methods you can use. One of which is:

    <code>copyfile(src, dst)
    </code>

    Copy the contents of the file named src to a file named dst. The destination location must be writable; otherwise, an IOError exception will be raised. If dst already exists, it will be replaced. Special files such as character or block devices and pipes cannot be copied with this function. src and dst are path names given as strings. 

    http://stackoverflow.com/questions/123198/how-do-i-copy-a-file-in-python

  • 相关阅读:
    存储型 XSS 原理复现
    反射型 XSS 原理复现
    HTTP 简易理解
    Markdown 流程图语法
    Dirsearch 快速开始
    sqlmap 快速开始
    SQL 注入原理
    XSS 原理
    51nod 1835 完全图
    11.5 AM 请求
  • 原文地址:https://www.cnblogs.com/lexus/p/1818510.html
Copyright © 2011-2022 走看看