Recursively look for files with a specific extension

后端 未结 10 1411
抹茶落季
抹茶落季 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 14:52

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

    is a bit shorter than that whole thing (and safer - deals with whitespace in filenames and directory names).

    Your script is probably failing for entries that don't have a . in their name, making $extension empty.

提交回复
热议问题