标签: python python-3.x shutil
如何在脚本中实现计时器,以便shutil copytree函数仅在一定时间内运行和复制文件,然后停止脚本或执行其他操作?
答案 0 :(得分:1)
直接,你不能。
间接地,您可以只take the code for shutil.copytree from source,因为它非常简单,并为其添加了时间限制。
shutil.copytree
请注意,如果您在任意点停止复制,最终将得到不完整的副本。