""" 用python批量获取某路径文件夹及子文件夹下的指定类型文件excel,并按指定路径进行存储 """ import os import os import win32com.client as win32 import shutil filelist_trans = [] path_trans = os.getcwd() #转换前程序所在文件目录 pathlist_trans = os.listdir(path_trans) filelist_same = [] path_same = str(os.getcwd() ) + '/bak/' #print(path_same) pathlist_same = os.listdir(path_trans) filelist_scan = [] path_scan = str(os.getcwd() ) + '/bak/' #print(path_scan) pathlist_same = os.listdir(path_trans) for trans in pathlist_trans: filelist_trans = os.path.join(path_trans, trans) # 将文件名加入到当前文件路径后面 #print(filelist_trans) print(os.path.splitext(filelist_trans)[0]) print(os.path.splitext(filelist_trans)[1]) if os.path.isfile(filelist_trans): # 如果是文件 if os.path.splitext(filelist_trans)[1] == ".xls": # 如果文件是".xls"后缀的