how i rename files, convert to .jpg, etc.

the command file: fix-downloads.cmd does the following:

rename .jpeg to .jpg

convert all the graphics files (PNG, JFIF, BMP, others?) in the current directory to .JPG

fix-downloads.cmd:

@echo off
::
:: rename all .JPEG -> .JPG
:: convert all the graphics files in the current directory to .JPG
::
:: PNG, JFIF, BMP,
::
::
:: we'll do them one at a time so we can catch errors; irfanview can do them as a
:: batch, but not sure how to handles errors
::
:: TO-DO: but how to get the errocode fromirfanview when it's in a for loop?  i think will need to
::        create another .CMD file that does the conversion on a passed filename and does the errorcode
::        check there, not here.
::
:: for now, just do the conversions in place, leaving the old files; to know the original format,
:: leave the original extension (foo.png -> foo.png.JPG
::
:: first renaname any .jepg to .jpg as the lord intended...

for %%x in (*.jpeg) do ren %%x %%x.jpg

for %%x in (*.png) do "C:\Program Files\IrfanView\i_view64.exe" %%x /convert=%%x.jpg

for %%x in (*.bmp) do "C:\Program Files\IrfanView\i_view64.exe" %%x /convert=%%x.jpg

for %%x in (*.jfif) do "C:\Program Files\IrfanView\i_view64.exe" %%x /convert=%%x.jpg

Leave a Reply