Last Updated: February 25, 2016
· azulinho

Batch upload of pictures to Flickr

Recently I decided to move all my photos into a new Flickr account (hey 1TB of storage).
I am a proud gnome 3 user, but I couldn't find any app that would survive the periodic outages of my crappy Virgin Media broadband.
So I decided to look up on github for some libraries I could use to upload all my pics overnight. is your friend here,

First go into the flickr website to generate a new API key:

create a file called flickr.yml and populate it with your flickr key and secret that you got from the URL above.

key: "yourkey"
secret: "yoursecret"
token_cache: "token_cache.yml"

then install the gem flickr_fu

gem install flickr_fu

And write a quick ruby script, named gettokencache.rb:

#!/usr/bin/env ruby
require 'flickr_fu'
flickr ='flickr.yml')
puts 'visit the following url, then click <enter> once you have authorized:'
puts flickr.auth.url(:write)

Execute it with
"ruby gettokencache.rb"
and your browser should open asking you to authenticate this app.
When its done, just click enter on the terminal and it should save the token into the token_cache.yml file.

Now create a new ruby script to upload all your pics to flickr,

#!/usr/bin/env ruby
 require 'flickr_fu'

x ='flickr.yaml')
pics = Dir["#{ENV['HOME']}/Pictures/**/*"] #<- this is where my pictures are kept

pics.each do |pic|
     puts pic
     puts "Dodgy pic: #{pic}"

and execute it as:
"ruby uploadallmypics.rb"