#!/bin/bash # Find the files just created and drop the extra suffix find . -maxdepth 4 -type f -iname '*.jpg.jpg' \ -exec sh -c '(hoplaa={}; mv -f "{}" "${hoplaa%.jpg}")' ';'