Guest User

Untitled

a guest
Mar 10th, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2. abort 'ang map baka' if ARGV.empty?
  3.  
  4. %w[net/ftp].each {|l| require l}
  5.  
  6. conf = {
  7. :host => '127.0.0.1',
  8. :user => 'jolts',
  9. :pass => 'test',
  10. :rdir => '.'
  11. }
  12.  
  13. ftp = Net::FTP.new conf[:host]
  14. ftp.login conf[:user], conf[:pass]
  15. ftp.chdir '/'
  16.  
  17. puts ["\n"] << ftp.dir << ["\n"]
  18.  
  19. ARGV.each do |file|
  20. filesize, completedsize, oldpercent = File.size(file).to_f, 0, 0
  21. ftp.put file, File.basename(file) do |data|
  22. completedsize += data.size
  23. percent = (completedsize / filesize) * 100
  24. increment = percent - oldpercent
  25. oldpercent = percent
  26. end
  27. end
  28.  
  29. ftp.close
Add Comment
Please, Sign In to add comment