| 主机参考:VPS测评参考推荐/专注分享VPS服务器优惠信息!若您是商家可以在本站进行投稿,查看详情!此外我们还提供软文收录、PayPal代付、广告赞助等服务,查看详情! |
| 我们发布的部分优惠活动文章可能存在时效性,购买时建议在本站搜索商家名称可查看相关文章充分了解该商家!若非中文页面可使用Edge浏览器同步翻译!PayPal代付/收录合作 |
yfn: bat不会 python会一点 不知道能不能行 import os import shutil import time import logging logging.basicConfig(level=logging.DEBUG) path = R20;./testDir” newPath = “./newDir” year = 2020 month = 4 day = 1 if(not os.path.isdir(newPath)): os.mkdir(newPath) dt = ‘{}-{}-{}’.format(year,month,day) ts = int(time.mktime(time.strptime(dt, “%Y-%m-%d”))) for i in os.listdir(path): fileName = path + “/” + i newFileName = newPath + “/” + i changeTime = os.stat(fileName) ct = changeTime.st_mtime if(ct>=ts): try: shutil.copy(fileName, newFileName) logging.info(“copy {} to {} successfully!”.format(fileName,newFileName)) except Exception as e: logging.error(“copy {} to {} unsuccessfully!=>{}”.format(fileName, newFileName,e))复制代码
hehe: 你这个没有递归,只能处理一层目录吧。只有一层的话直接用Windows右键自带的排序就好了。
这几篇文章你可能也喜欢:
- 暂无相关推荐文章
本文由主机参考刊发,转载请注明:求bat批处理大佬 https://dev-web.zhujicankao.com/20938.html
主机参考















评论前必须登录!
注册