首先安装好os包和shutil包,然后就可以把文件D:NYU Depth V2raw_datasetsbedrooms_part1bedroom_0001filename.bat拷贝到D:NYU Depth V2raw_datasetsbedrooms_part2下的各个子文件夹。代码如下:
# -*- coding: utf-8 -*- """ Created on Wed Oct 27 17:09:40 2021 @author: 17864 """ import os import shutil filePath = r'D:NYU Depth V2raw_datasetsbedrooms_part2' i = 1 for dirpath,dirnames,filenames in os.walk(filePath): #path = [os.path.join(dirpath,names) for names in dirnames] if i!= 1: print(dirpath) shutil.copy(r'D:NYU Depth V2raw_datasetsbedrooms_part1bedroom_0001filename.bat',dirpath) i = i-1



