If there are millions of files in the directory, you'll run into bash's maximum number of arguments ('*.jpg' will be expanded to every .jpg in the directory). You'll need to use find instead. Something like:
This will print one file per line.
find . -type f -name '*.jpg' > files.txt
You would also be better off using a 'while read' loop -- in this case, 'for' will break on any file containing spaces in its name
It's also possible to pipe the output of find straight into 'while read'; the version below uses nullbyte as the delimiter, which means that even filenames containing newlines will be handled correctly (nullbyte is one of the two characters that cannot be in a legal *nix filename, the other being forward-slash). This script will place files in directories named after the model of the camera, as determined by exiftool:
while read ARG; do
#exiftool stuff, as in TheFu's script, should go here
done < files.txt
As for your other question: the width of the image is listed by exiftool (with the '-S' option) with the key 'XResolution', and the height with 'YResolution'. You get them within a script like so:
#! /usr/bin/env bash
find . -type f -name '*.jpg' -print0 | while read -d $'\0' i; do
## get the name of the model -- the sed part
## finds a line beginning with 'Model:'
## (for sed, '^' means 'the beginning of the line')
## and then strips off the 'Model; ' part,
## leaving only the model of the camera
model=$(exiftool -S "$i" | sed -n '/^Model:/s/Model: //p')
## tests to see if a directory named for the camera model
## already exists; if it doesn't, then creates it with mkdir:
[[ -d "$model" ]] || mkdir "$model"
## tests that "$model" isn't empty, and then moves
## the file into the "$model" directory
## (if "$model" is empty, then there was no exifdata
## about what model of camera was used)
[[ "$model" != '' ]] && mv "$i" "$model"/
...and then you can test to see if they match whatever arbitrary resolution you want. Here is an example:
width=$(exiftool -S "$file" | sed -n '/^XResolution/s/.*://p')
height=$(exiftool -S "$file" | sed -n '/^YResolution/s/.*://p')
[[ $width$height == 300300 ]] && echo "The resolution is 300x300 pixels"