I know it's been a while since you posted this, but do you still require help?
If so, what does the file tree look like (bunch of folders in one, multiple folders in folders, etc)?
Also, are the resolutions found in the filename? (As in there exists something like both image_640x480.jpg and image_800x600)
Never accept the simple answers; the journey through complexity is where learning takes place.