The following command will resize any and all .jpg’s in the current directory that are larger than 500px on either side and put them in a file called ‘resized’. Aspect ratios will be respected, and the same filenames will be used for the modified images.
mogrify -path resized -resize 500>x500\> *.jpg
Yes, you have to use mogrify and not convert because only mogrify excepts the -path command. And I’m pretty sure it’s important to escape the greater than symbols in the -path argument like I did.