赞
踩
def delete_tif_files(folder_path):
for root, dirs, files in os.walk(folder_path):
for file in files:
if file.endswith('.tif'):
os.remove(os.path.join(root, file))
if os.path.getsize(result_path):
delete_tif_files(result_path)
![在这里插入图片描述](https://img-blog.csdnimg.cn/4ddafb5333a345c7981e3ce80dabafbe.png
if not os.path.exists(resule_path):
os.mkdir(path)
import os import shutil def copy_file(file_path,copy_path): if not os.path.exists(copy_path): os.mkdir(copy_path) os.chdir(file_path) print(os.path.abspath(os.curdir)) all_file = os.listdir() for f in all_file: if os.path.isdir(f): file = os.path.join(copy_path, f) if not os.path.exists(file): os.mkdir(file) file_path_new=os.path.join(file_path,f) copy_path_new=os.path.join(copy_path,f) check_file(file_path_new,copy_path_new) os.chdir(file_path) else: file_old=os.path.join(file_path,f) copy_path_new=os.path.join(copy_path,f) if not os.path.isfile(copy_path_new): shutil.copy(file_old, copy_path_new) file_path=r"" copy_path=r'' file_list = copy_file(file_path,copy_path) #待读取的文件夹
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。