linux - How to list the contents of a subdirectory after finding the directory -


this rather specific question, wondering if there anyway list contents of directory below 1 search for.

my case have parent directory ton of subdirectories want search on see if contain directory of string. since it's big make sure limit depth 2 avoid unnecessary searching. first command this:

find . -maxdepth 2 -type d -name "mwacluster15"

this typically return on order of 30 matches. i'd list contents of 1 of subdirectories called logs. thought maybe doing

find . -maxdepth 2 -type d -name "mwacluster15" | xargs ls logs/

might trick returns immediate contents of directory. want list contents of mwacluster15/logs/

anyone know if possible without having write bash script?

i guess use this:

find . -maxdepth 2 -type d -name "mwacluster15" -execdir ls {}/logs/ \; 

-execdir executes command directory in directory you're interested in found. {} placeholder substituted directory name "mwacluster15".


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -