Saturday, July 30, 2011

Rebuilding Picasa Folders on OS X

This fix will only work for those who've copied files from a Windows machine and are having trouble getting then to appear in Picasa.

Pictures Not Appearing In Picasa After Copy

I just imported 40,000 pictures from a Windows box to my MacBook. These were pictures that were taken on my round the world trip in 2010 / 2011. After letting Picasa do it's magic, I noticed that about 1/3 of the folders weren't appearing in the folder list on the left hand side.

I did a check by going to File > Add Folder to Picasa..., but was dismayed to see that the folders missing were listed there with the "Scan Always" icon. Confused, I closed Picasa and opened it again with no apparent effect.

I thought the solution would be to rebuild the database. But 2/3's of the images were showing up correctly in Picasa so I wondered if there was another way and if something fishy was going on.

For those that don't mind a bit of command line magic, there is and there was.

Pesky ".picasa.ini" Files

The issue lay in the invisible ".picasa.ini" files located in each of the directories that I copied. On the Mac, these files aren't used. I tried removing one of these files and saw Picasa start rebuilding thumbnails. Bingo!

So how do you do this en masse?  Use the find and xargs command on the command line.

Deleting Multiple ".picasa.ini" Files At Once

Here are the commands as I did them:

cd /Volumes/Files/boujin/Pictures
find . -name "*.picasa.ini" -path "*2010-10*" | xargs rm


Being a little wary of giving Picasa too much work too quickly, I decided against doing "2010*", which would have removed ".picasa.ini" files from all folders in 2010. Instead, I went month by month running the command. After executing the find command, I would wait for Picasa to index all of the photos and then move on to the next month.

Finishing Up

Images dating from 2010/10 to 2011/04 were missing, so I only had to do these folders / subfolders. After I had rebuilt the thumbnails for all these folders, I did one last check for ".picasa.ini" files in 2010 and 2011 and removed the remaining ones.

Finally, all my images were appearing as they should.

P.S.

I didn't use the "-print0" and "-0" flags for the find and xargs commands respectively, because doing so caused find to output all of the directories it was searching through. I didn't want to risk deleting some folder or file I wasn't targeting. However, there is an issue with this. If you're folders have spaces in them then the command I have listed won't work. If someone has an alternative version of the command above that would escape spaces correctly, please let me know.

No comments: