I saw these posts:
- mogrify - how do you recurse through subfolders in Windows
- Using imagemagick to identify all files in multiple subfolders
- https://stackoverflow.com/questions/30414346/batch-command-for-imagemagick-to-convert-all-files-in-a-directory-and-sub-direct
- https://stackoverflow.com/questions/784057/run-a-simple-command-using-powershell-recursively-on-a-directory
But all of the commands in it result in errors. Such as:
PS D:\> find . -name '*.png' -exec mogrify -format jpg {} +
FIND: Parameter format not correct
PS D:\> for /r . %a in (*.png) do mogrify -resample 90 -format jpg "%~a"
At line:1 char:4
+ for /r . %a in (*.png) do mogrify -resample 90 -format jpg "%~a"
+ ~
Missing opening '(' after keyword 'for'.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingOpenParenthesisAfterKeyword
PS D:\> for(/r . %a) in (*.png) do mogrify -resample 90 -format jpg "%~a"
At line:1 char:13
+ for(/r . %a) in (*.png) do mogrify -resample 90 -format jpg "%~a"
+ ~
Missing statement body in for loop.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingLoopStatement
PS D:\> for(/r . %a) {in (*.png) do mogrify -resample 90 -format jpg "%~a"}
/r : The term '/r' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:5
+ for(/r . %a) {in (*.png) do mogrify -resample 90 -format jpg "%~a"}
+ ~~
+ CategoryInfo : ObjectNotFound: (/r:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS D:\> magickrec . 90% png jpg
magickrec : The term 'magickrec' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ magickrec . 90% png jpg
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (magickrec:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS D:\>
I don't have enough reputation to comment/etc. on any questions here on superuser, so I cannot reply to anything. Also, I want to do this universally, so don't give me static paths like "D:" I want it in current directory, so I can use the command anywhere. In addition, the ImageMagick command executed should be mogrify NOT convert.