使用正则表达式查找命令以查找目录

时间:2017-10-20 18:47:18

标签: linux find path-finding

我有以下linux find命令给出一个基本路径,然后搜索是否有任何包含名称的目录3.7.1

在我的基本路径/ some / folder / path / folder1中,我想将folder1更改为正常表达式,如文件夹[1-3],我该怎么做?

# working command
find /some/folder/path/folder1/another_folder -type d -name "3.7.1*" -ls

# would like to use some regular expresion on folder1-3
find /some/folder/path/folder[1-3]/another_folder -type d -name "3.7.1*" -ls


error I am seeing:  /folder[1-3]/another_folder/': No such file or directory

1 个答案:

答案 0 :(得分:0)

这已经是正确的语法:

find /some/folder/path/folder[1-3] -type d -name "3.7.1*" -ls