Thursday, October 3, 2013

Picasa: Renaming File Names to Picasa Captions

Some 5 years back, I wrote on this blog on how to set the caption of a image as it file name. In those days, I used to change the filename first and then set the caption for picasa. Now things have moved online and today I set the caption first is Google + (which did not exist then) and then downloaded the album to my local picasa and tried to rename the file. How to do it?

With some Windows commandline revision and use of Exiv2 I was able to achieve it. So here it goes.
  1. I assume that you have downloaded the picasa web album to a local folder using picasa.
  2. Open command window and type in :
    forfiles /C "cmd /c ..\exiv2 -g Exif.File name -g Iptc.Application2.Caption  -Pv @file" > files.txt
  3. This will create a file "files.txt which will look like :
    100.jpg             1. My caption
    where the 1st column is the File Name and the 2nd column is the given caption.
  4. Open the files.txt in Notepad++ and edit it. Replace the huge space between the filename and caption with some deliminator like ';'. The result should look like:
    100.jpg;1. My caption
  5. Now in the command window type in:
    for /f "tokens=1,2  delims=;" %i in (files.txt) do ren "%i" "%j.jpg"
    This will take the filename as the first token and caption as the 2nd token as we have used the deliminator ';' and then do a rename. Note that I have use %j.jpg" to give it the correct extension.
  6. And the job is done :)