繁体   English   中英

为什么 dir.create 无法创建目录“结果”,原因是“没有这样的文件或目录”?

[英]Why does dir.create give cannot create dir 'results', reason 'No such file or directory'?

运行分析后,我尝试创建一个新文件夹并保存我的结果。 我收到消息:

dir.create("results") 警告信息:在 dir.create("results"): cannot create dir 'results', reason 'No such file or directory'

如果您想创建一个新的嵌套目录,例如"D:/mytest/myresults" ,则需要创建D:/mytest以及子目录/myresults ,使用时dir.create()不起作用

dir.create("D:/mytest/myresults")

因为"D:/mytest"不存在,你不能创建"D:/mytest/myresults"并且你会收到警告:

在 dir.create("D:/mytest/myresults"): 无法创建目录 'D:\mytest\myresults',原因 '没有这样的文件或目录'

使用recursive = TRUE insted:

dir.create("D:/mytest/myresults", recursive = TRUE)

使用recursive = TRUE相当于先创建基目录,然后创建子目录,如:

dir.create("D:/mytest")
dir.create("D:/mytest/myresults")

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM