0

I'm attempting to do as my question title indicates, here is my best attempt so far:

find . -name '*.jpeg' -exec mogrify -rotate 90 '*.jpeg' {} +

This seems to rotate the images in the current directory and sub-directories 90 degrees clockwise (put a negative sign in front of the 90 and it will do counter-clockwise), but I get this error:

mogrify-im6.q16: unable to open image `*.jpeg': No such file or directory @ error/blob.c/OpenBlob/2874.

I'm not sure if this matters but it certainly isn't reassuring. I'm aware that to list all .jpegs within a directory and sub-directories is:

find . -name '*.jpeg'

and the basic syntax of exec is:

-exec command {} +

so the above apparently isn't quite right, can anybody tell me what I'm doing wrong? I'm using Ubuntu 20.04 if that matters.

cdahms
  • 121
  • 4

1 Answers1

0

Just figured it out, the trick is that after the 1st '.jpeg' the files already found so there is no need to provide the 2nd '.jpeg'.

For reference:

To recursively rotate jpeg images 90 degrees clockwise:

find . -name '*.jpeg' -exec mogrify -rotate 90 {} +

To recursively rotate jpeg images 90 degrees counter-clockwise:

find . -name '*.jpeg' -exec mogrify -rotate -90 {} +
cdahms
  • 121
  • 4