List all files in a directory with a certain extension

后端 未结 3 1910
伪装坚强ぢ
伪装坚强ぢ 2021-01-11 18:34

Let\'s say I want to list all php files in a directory including sub-directories, I can run this in bash:

ls -l $(find. -name *.php -type f)

3条回答
  •  执笔经年
    2021-01-11 19:18

    I suggest you to firstly search the files and then perform the ls -l (or whatever else). For example like this:

    find . -name "*php" -type f -exec ls -l {} \;
    

    and then you can pipe the awk expression to make the addition.

提交回复
热议问题