Reputation: 1273
ls *
can list all the files in the subdirectories.
ls *.pdb
can only list all the files with extension pdb
in the current directory.
So how to list all the files with extension pdb
in the subdirectories?
My subdirectories are named as 1
, 2
, 3
, .... I would like the output also include the directory information, so that I can use the output as an ensemble of input files. For example, the output should be like:
1/a.pdb 1/b.pdb 1/c.pdb 2/a.pdb 2/b.pdb 2/c.pdb 3/a.pdb 3/b.pdb 3/c.pdb
Upvotes: 11
Views: 29774
Reputation: 9
Try this too:
locate */*.pdb
Its for previously made database
You can see the difference, if you code some Python and right after that use both
locate */*.py
ls */*.py
Upvotes: 0
Reputation: 185161
3 solutions :
glob
ls */*.pdb
shopt -s globstar
ls **/*.pdb
find . -type f -name '*.pdb'
Upvotes: 16