根据匹配与壳牌通配所有嵌套的目录中的所有文件 [英] Match all files under all nested directories with shell globbing
问题描述
有没有使用shell通配识别嵌套目录的方式?
Is there a way to use shell Globbing to identify nested directories?
所以,如果我有DIR / DIR1 / DIR2 / DIR3 / dir4 / dir5 / ..和我有文件下的所有的人,什么是相当于通配符匹配模式下的所有目录中的所有文件,类似于 - 例如 - LS -R
so if I have dir/dir1/dir2/dir3/dir4/dir5/.. and I have files under all of them, what is the equivalent globbing pattern to match all files under all directories, similar to - for example - ls -R
推荐答案
在猛砸4,用禁用了javascript -s globstar
和zsh你可以使用 ** / *
,其中将包括除隐藏文件的一切。你可以做禁用了javascript -s dotglob
中的Bash 4或 SETOPT dotglob
在zsh来使隐藏文件包括在内。
In Bash 4, with shopt -s globstar
, and zsh you can use **/*
which will include everything except hidden files. You can do shopt -s dotglob
in Bash 4 or setopt dotglob
in zsh to cause hidden files to be included.
在KSH,设置-o globstar
启用它。我不认为有一种方法可以隐含地包括点文件,但我觉得 ** / {[^]} *
和
In ksh, set -o globstar
enables it. I don't think there's a way to include dot files implicitly, but I think **/{.[^.],}*
works.
这篇关于根据匹配与壳牌通配所有嵌套的目录中的所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!