List all files in a directory with a certain extension

后端 未结 3 1906
伪装坚强ぢ
伪装坚强ぢ 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 18:58

    Here is another way, using du:

    find . -name "*.php" -type f -print0 | du -c --files0-from=- | awk 'END{print $1}'
    

提交回复
热议问题