Is it possible to mogrify subdirectories using a wildcard, with a command like this:
mogrify -quality 85 '/photo1/*/*.jpg'
I found the above example on an imagemagick mailing list from 2006:
http://www.mail-archive.com/magick-user ... 00232.html
I can't get it to work on windows xp, and I don't see any references to it on imagemagick.org. Is it supposed to work?
Thanks!
mogrify subdirectories using wildcard
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: mogrify subdirectories using wildcard
I don't think IM allows you to work on images in wildcard directories. But I have not tried that.mogrify -quality 85 '/photo1/*/*.jpg'
But even if you specify the directory, is /photo1/ your root directory? If not and if that is a subdirectory of your current directory then your probably want to specify './photo1/...'
I stand corrected. I tried
mogrify -format jpg test1/*/*.png
and
mogrify -format jpg ./test1/*/*.png
and
mogrify -format jpg /Users/fred/test1/*/*.png
and they each work, where I had two subdirectories, test2 and test3 in test1, each with a png file.
It did not work with either single or double quotes on my Mac OSX Tiger, IM 6.6.3.0 Q16
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: mogrify subdirectories using wildcard
NOTE: Under UNIX/LINUX/MacOSX environment: without quotes you are asking for the shell (command line) program to expand the wildcards. With quota you are passing the wildcards to ImageMagick to expand the wildcard. These are quite different, and the later will prevent you overflowing the command line buffer in some older shell implementations.
DOS does not do this expansion and just passed wild cards to the program (ImageMagick)
That is why IM can do wildcard expansion, though in some cases that could open a security hole.
Which is why security sensitive applications should sanities all input.
DOS does not do this expansion and just passed wild cards to the program (ImageMagick)

That is why IM can do wildcard expansion, though in some cases that could open a security hole.
Which is why security sensitive applications should sanities all input.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: mogrify subdirectories using wildcard
Thank you Anthony and Fred! That explains why it didn't work in DOS, and didn't work with quotes.
I did try it in a unix-type shell (cygwish80) without quotes, and still got error "invalid argument". Maybe I need a newer unix shell.
I did try it in a unix-type shell (cygwish80) without quotes, and still got error "invalid argument". Maybe I need a newer unix shell.