Koen Handekyn
Sunday, January 02, 2011
 
virtual folder of starred picasa pictures
Below a code example that creates a set of nested virtual folders (using windows system links) of all your starred picasa pictures.

This is perfect for syncing your best photos to your iphone or ipad

Koen

require 'fileutils'

file = File.new('C:\Users\Koen\AppData\Local\Google\Picasa2\db3\starlist.txt', 'r')
counter = 0
lastdir = ""
while (line = file.gets)

## puts line unless line.include? "2010-10"

## puts "#{counter}: #{line}"
elements = line.split('\\')

## puts elements[-2]
next unless elements[-2].include? "2010"

subdir = "starred\\#{elements[-2]}"
if ( lastdir === subdir )
# do nothing
else
lastdir = subdir
puts subdir
FileUtils.mkpath(subdir)
end
target = "starred\\#{elements[-2]}\\#{elements[-1].chomp}"
instruction = "cmd.exe /c mklink /H \"#{target}\" \"#{line.chomp}\""
# puts instruction
system instruction
puts $?

counter = counter + 1
end
puts counter
file.close


Powered by Blogger