#!/usr/bin/env ruby
#Very simple ftp upload program by ruby
if ARGV[0] == nil
abort "\nInput ftp site ip or domain name"
elsif ARGV[1] == nil
abort "\nInput the text file that you want to upload"
end
require 'net/ftp'
ftp = Net::FTP.new(ARGV[0])
ftp.passive = true
ftp.login 'yourname', 'yourpasswd'
ftp.chdir('/dir/to/you/want')
ftp.puttextfile(ARGV[1])
#ftp.putbinaryfile(ARGV[1])
ftp.list('*') { |file| puts file }
ftp.close
No comments:
Post a Comment