Skip to content

Instantly share code, notes, and snippets.

@johnwake
Created August 30, 2012 12:18
Show Gist options
  • Save johnwake/3527413 to your computer and use it in GitHub Desktop.
Save johnwake/3527413 to your computer and use it in GitHub Desktop.
Simple Ruby FTP file script
require 'uri'
require 'open-uri'
require 'net/ftp'
uri = URI.parse('ftp://User@Server')
Net::FTP.open(uri.host) do |ftp|
ftp.login 'username', 'password'
ftp.passive = true
puts ftp.pwd
ftp.chdir('home/test')
puts ftp.list
ftp.puttextfile('LocalFileLocation')
ftp.close
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment