我是一个python新手,我正在编写一个脚本来将编译好的文件从一个位置复制到另一个位置。我目前所面对的是非常简单的,像这样:我们可以在Python中做一个智能副本吗?
import os
import shutil
shutil.copy2 (src, dst)
#... many more shutil.copy commands
#src is a filename string
#dst is the directory where the file is to be copied
我的问题是,许多文件被复制是较大的文件,而不是所有的人都重新编译每个编译循环。理想情况下,我只想复制此脚本中已更改的文件。有什么办法可以做到这一点?
为什么'> 1' - 应该说不是'> 0'? – Wikis 2014-09-24 08:33:04
取决于用例,我想。如果文件总是使用'shutil.copy2'写入,那么修改时间可以预期完全相等(然后是'> 0')。 – AndiDog 2014-09-24 10:49:42