繁体   English   中英

在Windows的.txt文件中复制文件夹中的文件,但不包括其中的一些文件

[英]copy files in a folder excluding some of them from a .txt file in windows

我有许多名为img-1 img-2 ... etc的图像和json文件。 在一个文件夹中,我想复制它们,但不包括txt文件中的某些数字,例如:100 1001 20345或只是复制所有它们并从.txt中删除它们。我只有Windows7和Mac,我不知道因为找到了命令robotcopy,所以如何开始它。 我知道这个问题有点简单,但是我需要一些提示来开始。

python答案:导入操作系统计数= 100000 x = list(range(1,count + 1))text_file = open(“ delete.txt”,“ r”)del_imgs = text_file.readlines()for del_imgs中的del_img:t = del_img .split(“ \\ n”)img_path =“ D:/ images / img-” + t [0] +“。bmp” json_path =“ D:/ images / img-” + t [0] +“。json” os.remove(img_path)

顺便问一下,哪条路会更快? 批处理脚本还是c&c ++?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM