R批量读取文件夹下的tif文件,并将文件的绝对路径存储为列表
# 文件夹名称
folder_path <- "D:/YRB/P-AET/D_test"
# 获取文件夹中的所有tif文件
tif_files <- list.files(folder_path, pattern = "\\.tif$", full.names = TRUE)
R语言进行路径拆分,获取部分路径名称
# 文件夹路径
folder_path <- "D:/YRB/P-AET/D_test"
# 依据“/”断开路径,存为列表
path_components <- unlist(strsplit(folder_path, "/"))
print(path_components[1]) # D:
print(path_components[2]) #YRB