Reputation: 61
I have this directory structure. How to list only files in all F40 sub sub folders in bash? Thanks
Upvotes: 1
Views: 219
Reputation: 61
You can your xargs with find command
find DIR -type d -name F40 | xargs ls
Upvotes: 0
Reputation: 777
The find
command, combined with ls
, can do it. For instance like this:
find DIR -type d -name F40 -exec ls {} \;
As the GNU find
man page says, the find
command is used for file search in a directory hierarchy.
In this case find
searches the DIR
folder for folders (-type d
) explicitly named F40
, and then it executes the ls
(list directory) command to show what's inside.
Upvotes: 3