Skip to content

Instantly share code, notes, and snippets.

@ebibibi
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save ebibibi/64ca2cdd0aa1bbb2d516 to your computer and use it in GitHub Desktop.

Select an option

Save ebibibi/64ca2cdd0aa1bbb2d516 to your computer and use it in GitHub Desktop.
flickr upload sample1
require 'flickraw'
FlickRaw.api_key=""
FlickRaw.shared_secret=""
flickr.access_token = ""
flickr.access_secret = ""
# From here you are logged:
login = flickr.test.login
puts "You are now authenticated as #{login.username}"
#flickr.upload_photo PHOTO_PATH + PHOTO_NAME, :title => PHOTO_NAME
def recursive_dir(path)
Dir::foreach(path) do |v|
next if v == "." or v == ".."
if path =~ /\/$/
#基本的にWindowsではここにはこない
v = path + v
else
file = v
v = path + "/" + v
end
if v =~ /.*\.jpg$|.*\.mov$|.*\.avi$|.*\.mp4$/i
p "upload : " + v
flickr.upload_photo v, :title => file
end
if FileTest::directory?(v)
recursive_dir(v)
end
end
end
recursive_dir "E:\\picture"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment