Recursively look for files with a specific extension

后端 未结 10 1287
抹茶落季
抹茶落季 2020-11-29 14:38

I\'m trying to find all files with a specific extension in a directory and its subdirectories with my bash (Latest Ubuntu LTS Release).

This is what\'s written in a

相关标签:
10条回答
  • 2020-11-29 15:03
    find "$PWD" -type f -name "*.in"
    
    0 讨论(0)
  • 2020-11-29 15:09

    The syntax I use is a bit different than what @Matt suggested:

    find $directory -type f -name \*.in
    

    (it's one less keystroke).

    0 讨论(0)
  • 2020-11-29 15:10

    Without using find:

    du -a $directory | awk '{print $2}' | grep '\.in$'
    
    0 讨论(0)
  • 2020-11-29 15:12

    To find all the pom.xml files in your current directory and print them, you can use:

    find . -name 'pom.xml' -print
    
    0 讨论(0)
提交回复
热议问题