Today I needed to take a large folder of images that I had taken from our new DSLR (the Canon 5D Mk 2) and convert them to reduced file size versions of the originals.

I found this handy script from this question to do the conversion using ImageMagic:

for file in OriginalSize/*; do convert $file -define jpeg:extent=2MB ReducedSize/`basename $file`; done

Basically the script is run from the root folder which has two sub folders for the original images and another folder for the reduced size verions.

There is a part of the command which specifies the maximum size that the output file needs to be converted to, currently I am using 2 MB.