You could combine `identify` with [`find`](https://linux.die.net/man/1/find), for example:
    find . -type f -iname "*.jpg" -exec identify -format '%w %h %i\n' {} \;
which will run your `identify` command for every file recursively found with name ending in .jpg (case-insensitive).
Using your full example:
    find . -type f -iname "*.jpg" -exec identify -format '%w %h %i\n' {} \; |
    awk '$1 > 1200 || $2 > 1200 {sub(/^[^ ]* [^ ]* /, ""); print}' |
    tr '\n' '\0' |
    xargs -0 mogrify -resize '1200x1200'