Fix issue with mv failing.

The source contains an extension. Need to account for that and remove it
when looking for the optimized image.