I'm trying to list all the files in a directories including subdirectories that end with _input.txt
.
我正在尝试列出目录中的所有文件,包括以_input.txt结尾的子目录。
- folder 1
- a_input.txt
- folder 2
- b_input.txt
If folder 1 were my working directory, I would like list.files(pattern = "\\_input.txt$")
to be able to detect both a_input.txt
and b_input.txt
如果文件夹1是我的工作目录,我希望list.files(pattern =“\\ _ input.txt $”)能够检测到a_input.txt和b_input.txt
1 个解决方案
#1
28
To list the matching files in all subdirectories, you can use recursive = TRUE
in list.files()
要列出所有子目录中的匹配文件,可以在list.files()中使用recursive = TRUE
list.files(pattern = "_input.txt$", recursive = TRUE)
#1
28
To list the matching files in all subdirectories, you can use recursive = TRUE
in list.files()
要列出所有子目录中的匹配文件,可以在list.files()中使用recursive = TRUE
list.files(pattern = "_input.txt$", recursive = TRUE)