Created
May 2, 2009 06:15
-
-
Save seungjin/105437 to your computer and use it in GitHub Desktop.
simple ftp upload program
This file contains hidden or 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
#!/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