Created
August 30, 2012 12:18
-
-
Save johnwake/3527413 to your computer and use it in GitHub Desktop.
Simple Ruby FTP file script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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