Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby19
- # encoding: utf-8
- require 'net/ftp'
- module RuFTP
- extend self
- Hostname = ''
- def upload(args = ARGV)
- puts 'Files to upload:'
- args.each { |file| puts "> #{File.expand_path(file)}" }
- @myftp = Net::FTP.new(Hostname)
- authenticate
- print "Enter remote directory ('/' for current):\n> "
- @myftp.chdir($stdin.gets.chomp.to_s)
- args.each do |file|
- puts "Uploading #{File.basename(file)}"
- @myftp.put(file, File.basename(file))
- end
- @myftp.close
- end
- private
- def authenticate
- _username = ''
- _password = ''
- @myftp.login(user = _username, passwd = _password)
- end
- end
- RuFTP.upload if $0 == __FILE__
Add Comment
Please, Sign In to add comment