How to recursively search for files with certain extensions?

47,642

Solution 1

You can use the following find command to do that:

find /path/to/search -iname '*.psd'

iname does a case insensitive search.

Solution 2

you also can

ls ./**/*.psd

but:

  • you must have bash version 4+
  • you must have shopt -s globstar #in your .bashrc or .profile, etc....
  • will search case sensitive (or you must set shopt -s nocaseglob too)
Share:
47,642

Related videos on Youtube

StackOverflowNewbie
Author by

StackOverflowNewbie

Updated on July 09, 2022

Comments

  • StackOverflowNewbie
    StackOverflowNewbie almost 2 years

    I need to find all the .psd files on my Linux system (dedicated web hosting). I tried something like this: ls -R *.psd, but that's not working. Suggestions?

  • StackOverflowNewbie
    StackOverflowNewbie about 13 years
    I don't know the exact path. How do I do this recursively?
  • onteria_
    onteria_ about 13 years
    @StackOverflowNewbie It already does it recursively. /path/to/search is where you want it to start searching from. If it's the current directory use find . -iname '*.psd'
  • Mahn
    Mahn about 7 years
    Or find / -iname '*.psd' to search the whole system.