C:\>cmd /v:on /c "for /f %i in ('dir /b *.JPG') do @(@set a=%i && @copy ..\!a:JPG=DNG! && @del /q !a!)"
I don't really use a photo management program. I know I should, but all the ones I've tried were either crap or expensive. When organizing photos from a particular event, I have a folder, say "Zoo," that contains the full-resolution raw files and the 2MP JPEG files from my camera. (I set my camera to RAW+JPEG, but the JPEG size to 2MP for easier management.) As I go through the images, I copy the good ones into a folder called "keepers." Afterward, I want to take the low-res JPEGs and replace them with the full-res raw files for processing.
At it's heart, this command is just:
C:\>for /f %a% in ('dir /b *.JPG') do @(@copy ..\%a:JPG=DNG% && @del /q %a%)
In other words, for all of the .JPG files in this directory, copy the corresponding .DNG file from the parent directory. If (and only if) that worked, delete the JPG.
But, as always, Windows needs a little handholding, first variable operations on a temporary loop variable, and then, to enable delayed expansion so that variables work in FOR loops.
In Linux, which is generally where I need this operation, it's a LOT more elegant:
for i in *;do cp ../${i%JPG}DNG . && rm $i;done
No comments:
Post a Comment