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 = 0lastdir = ""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 nothingelselastdir = subdirputs subdirFileUtils.mkpath(subdir)endtarget = "starred\\#{elements[-2]}\\#{elements[-1].chomp}"instruction = "cmd.exe /c mklink /H \"#{target}\" \"#{line.chomp}\""# puts instructionsystem instructionputs $?counter = counter + 1endputs counterfile.close