Making thumbnails with full directory structure [SOLVED]
Posted: 2014-05-29T13:08:18-07:00
Hi,
I'm new to ImageMagic and I'm sure that someone has already asked this question but I have not been able to find the answer. So if it has been asked could someone point me in the right direction?
Ok, to the problem. I have 70 000+ photos (.jpg, CR2, CRW etc) in 100+ folder (that might have subfolders) and I want to make a small thumbnail of all of them to another directory with the "full" path. I know it is not directly a ImageMagick problem but more of a linux command line issue.
As an example, my photo structure could look like this:
/media/photos/
/media/photos/folder1/photo1.jpg
..
/media/photos/folder1/photo1450.jpg
/media/photos/folder2/folder3/photo1.CR2
..
/media/photos/folder2/folder3/photo100.CR2
and so on
I now want to have my thumbnails in another directory (for example /var/www/thumbnails/ ) with the full (from the photos directory) path like this:
/var/www/thumbnails/folder1/photo1.jpg ...
/var/www/thumbnails/folder2/folder3/photo1.jpg
With the command below (executed in /media/photos/) I get all the thumbnails in the right base directory but images in subfolders gives an error (because the subfolder does not exist)
I do not know if ImageMagick can write to subfolders that does not exists, so I need to figure out if it exists first and if needed create it before writing the thumbnails? Any ideas on how to solve this?
Thanks in advance!
I'm new to ImageMagic and I'm sure that someone has already asked this question but I have not been able to find the answer. So if it has been asked could someone point me in the right direction?
Ok, to the problem. I have 70 000+ photos (.jpg, CR2, CRW etc) in 100+ folder (that might have subfolders) and I want to make a small thumbnail of all of them to another directory with the "full" path. I know it is not directly a ImageMagick problem but more of a linux command line issue.
As an example, my photo structure could look like this:
/media/photos/
/media/photos/folder1/photo1.jpg
..
/media/photos/folder1/photo1450.jpg
/media/photos/folder2/folder3/photo1.CR2
..
/media/photos/folder2/folder3/photo100.CR2
and so on
I now want to have my thumbnails in another directory (for example /var/www/thumbnails/ ) with the full (from the photos directory) path like this:
/var/www/thumbnails/folder1/photo1.jpg ...
/var/www/thumbnails/folder2/folder3/photo1.jpg
With the command below (executed in /media/photos/) I get all the thumbnails in the right base directory but images in subfolders gives an error (because the subfolder does not exist)
Code: Select all
find * -name '*.jpg' -o -name "*.CR2" -o -name "*.CRW -exec convert '{}' -auto-orient -resize 640x480 -quality 60 /var/www/thumbnails/'{}'.jpg \;
Thanks in advance!