Not exactly WordPress related, but here's a short example using a `find` with a *directory* type and zero *maxdepth*: $ find /srv/users/serverpilot/apps/*/public/ \ -type d \ -maxdepth 0 \ -exec /usr/local/bin/wp core update --path={} \; or in a single line: $ find /srv/users/serverpilot/apps/*/public/ -type d -maxdepth 0 -exec /usr/local/bin/wp core update --path={} \;