Skip to content

Instantly share code, notes, and snippets.

@seungjin
Created May 2, 2009 06:15
Show Gist options
  • Save seungjin/105437 to your computer and use it in GitHub Desktop.
Save seungjin/105437 to your computer and use it in GitHub Desktop.
simple ftp upload program
#!/usr/bin/env ruby
require 'net/ftp'
ftp = Net::FTP.new('www.myftpserver.com')
ftp.passive = true
ftp.login('myuserid','mypassowrd')
files = ftp.chdir('/data')
#Currnet localpath
cwd = Dir.getwd
#Check contents.xml
targetFile = cwd+'/contents.xml'
if File.exist?(targetFile)
files = ftp.puttextfile(targetFile)
else
print "'contents.xml' file does not exist"
end
ftp.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment