| 1. |
Solve : Convert Tiff file only if condition applies? |
|
Answer» Hello fellow msdos coders, I wish I could do this with python or some other uncluttered language, but it has to be dos... I thank you in advance for any input. You could pipe the output of identify to find.exe and use the && (success) operator to decide whether to run convert thanks, it does the trick!Ahah, so I have a little more WORK on that script, right now it works, but instead of using a prefix, I'd like to copy my newly converted files into a subfolder, unfortunately it gets processed as well, resulting in a neverending loop! Any ideas? Code: [Select]for /r %%a in (*.tif) do identify -verbose "%%~fa" | find "Adobe RGB (1998)" && mkdir "%%~pa/sRGB" && convert -profile AdobeRGB1998.icc -profile sRGB.icm "%%a" "%%~pa/sRGB/%%~na.tif" Copy them into a folder outside the tree being walked by FOR /R, or instead of FOR /R you can use FOR /F to parse the output of 'dir /b /s *.tif', use %%~pa to identify those tifs not in the converted folder, which you convert and move. Quote I'd like to copy my newly converted files into a subfolder, unfortunately it gets processed as well, resulting in a neverending loop! But don't the converted files have a different profile? How do they get processed twice? |
|