Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从R中受密码保护的zip文件夹中提取文件_R - Fatal编程技术网

从R中受密码保护的zip文件夹中提取文件

从R中受密码保护的zip文件夹中提取文件,r,R,我正在尝试解压远程服务器中的一些.zip文件。 我尝试了Kim建议的确切步骤,并将7z修改为zip 然而,这对我来说并不适用。知道哪里出了问题吗 file_list <- list.files(path = "C:/Users/Username/Documents", pattern = ".zip", all.files = T) pw = readline(prompt = "Enter the password: ") for (file in file_list) { sys

我正在尝试解压远程服务器中的一些.zip文件。 我尝试了Kim建议的确切步骤,并将7z修改为zip

然而,这对我来说并不适用。知道哪里出了问题吗

file_list <- list.files(path = "C:/Users/Username/Documents", pattern = ".zip", all.files = T)

pw = readline(prompt = "Enter the password: ")

for (file in file_list) {
sys_command = paste0("unzip ", "-P ", pw, " ", file)
system(sys_command)

}

file\u list管理解压缩.7z和.zip格式受密码保护的文件

system("7z x test.7z -ptest") #working for .7z extension files, pw: test
system("7z x test.zip -ptest") #working for .zip extension files, pw: test
我遗漏了一个步骤,那就是将7-Zip程序添加到R路径

if(dir.exists("C:/Program Files/7-Zip/")) 
{   
    paste0("7-Zip exists!")
    old_path <- Sys.getenv("PATH")
    Sys.setenv(PATH = paste(old_path,"C:\\Program Files\\7-Zip\\", sep = ""))
}
if(目录存在(“C:/Program Files/7-Zip/”)
{   
粘贴0(“存在7-Zip!”)

旧路径可能存在空间问题?请尝试将名称更改为
Data\u Science\u Lifecycle.zip
?我过去在文件路径中遇到过空间问题。请尝试将文件路径/文件名放在引号中,如下所示:
可以打印的示例(sys\u命令)并在windows终端上运行,看看它是否工作正常?尝试了此操作,但出现错误127。示例中的
test.zip
在哪里?