Match all files under all nested directories with shell globbing

后端 未结 6 1059
星月不相逢
星月不相逢 2021-02-03 23:35

Is there a way to use shell globbing to identify nested directories?

so if I have dir/dir1/dir2/dir3/dir4/dir5/.. and I have files under all of them, what is the equival

6条回答
  •  既然无缘
    2021-02-04 00:12

    There is no way to do this with vanilla Bash, however most commands accept a -R or --recursive option to tell them to descend into directories.

    If you simply want to list all files located anywhere within a directory or its sub-directories, you can use find.

    To recursively find files (-type f) with a given directory:

    find  -type f
    

提交回复
热议问题