Windows批量复制文件copy命令bat批处理文件

如果需要复制很多文件,手动肯定是累死人的。

我们可以使用后缀为.bat的批处理文件,双击运行。

自己写一个.bat就好了

import json

with open('long_answer_example_subval.json', 'r') as input:
    a = json.load(input)#一个包含文件名字的字典

o = open('cmd.txt','w')#包含命令的输出文件,后期需要把.txt后缀改成.bat

for k, v in a.items():
    image_path = v["image_path"]
    image_path = image_path.replace('/', '\\')# windows下的路径格式
    cmd = 'copy D:\\Work\\content\\ST-VQA\\ST-VQA\\'+image_path+' D:\\Work\\lctog\\best_CAN\\example_pictures\\' + image_path
    o.write(cmd)
    o.write('\n')
o.write('PAUSE')
o.close()

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值