如果文件路径中有变量,我将如何查找文件路径是否存在?
month = format(Sys.Date()-32, format = "%Y-%m")
dir = file.path("Some:\\Path\")
ec = file.path(month)
tory = file.path("\continued.csv")
if (file.exists(dir,ec,tory)){
print('TRUE')
} else {
print('FALSE')
}
我正在尝试查看是否存在“ Some:\ Path \ 2020-09 \ continued.csv”。如果我下个月要运行此程序,它将搜索“ Some:\ Path \ 2020-10 \ continued.csv”