So I have 20 subfolders full of files in my main folder and have around 200 files in every subfolder. I've been trying to write a script to convert every picture in every subfolder to DNG. I have done some research and was able to batch convert images from the current folder. I've tried developping the idea to get it to work for subfolders but to no success. Here is the code I've written:
for D in 'find . -type d'; do for i in *.RW2; do sips -s format jpeg $i --out "${i%.*}.jpg"; cd ..; done; done;
The easiest and fastest way to do this is with GNU Parallel like this:
because that will use all your CPU cores in parallel. But before you launch any commands you haven't tested, it is best to use the
--dry-runoption like this so that it shows you what it is going to do, but without actually doing anything:Sample Output
If you like the way it looks, remove the
--dry-runand run it again. Note that the-inameparameter means it is insensitive to upper/lower case, so it will work for ".RW2" and ".rw2".GNU Parallel is easily installed on macOS via homebrew with:
It can also be installed without a package manager (like homebrew) because it is actually a Perl script and Macs come with Perl. So you can install by doing this in Terminal:
Your question seems confused as to whether you want
DNGfiles like your title suggests, orJPEGfiles like your code suggests. My code generates JPEGs as it stands. If you wantDNGoutput, you will need to install Adobe DNG Converter, and then run:There are some other options you can append to the end of the above command:
-ewill embed the originalRW2file in theDNG-uwill create theDNGfile uncompressed-flwill add fast load information to theDNGDNG Converter seems happy enough to run multiple instances in parallel, but I did not test with thousands of files. If you run into issues, just run one job at a time by changing to
parallel -j 1 ...Adobe DNG Converter is easily installed under macOS using homebrew as follows: