0

'ls dir1/*/.ext' just lists all the files with just one level of nesting. What is the command to recursively list all the files with any level of nesting in linux?

4 Answers 4

4
ls -R dir1

Or:

find dir1 -name "*.ext"
1

The find command is one way to do this:

find dir1 -name .ext

The -name operator can take a wildcard to match with, but it's important to quote the wildcard expression so that it won't be expanded by your shell before calling into find:

find dir1 -name "*.ext"

The find command has many operators that can do various different tests on the files in the directory, of which -name is just one example. Consult the find manual page for more information.

0

To list folder recursively:

ls -R
0

You could use find:

find .

That command would list everything under the current folder

Not the answer you're looking for? Browse other questions tagged or ask your own question.