I have a directory called src
full of sub directories and other images. I tried to use one bash statement to automatically resize them all to another destination directory called thumb
like this:
find ./src -type f -follow -iname '*.jp*g' -exec convert -resize 150x150x "{}" "./thumb/${size}/{}" \;
This didn't work because the thumb
directory is initially empty and doesn't have the same directory structure as src
.
I tried to look up the man convert
but I can't seem to find the option to automatically make the directories on convert
. What's an effective way to convert all my images into a thumbnail size in the thumb
directory? Do I need pre-create all the sub directories in thumb?
EDIT
I preceded the command above with this:
find ./src -type d -follow -exec mkdir -p "thumb/${size}/{}" \;
But I'm curious if I'd be able to do everything with one command instead of two?