Method: Monster::Remote::Wrappers::NetFTPHandler#copy_file

Defined in:
lib/monster/remote/wrappers/net_ftp.rb

#copy_file(from, to) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/monster/remote/wrappers/net_ftp.rb', line 62

def copy_file(from, to)
  if (dirs = dirs_in_path(to)).size > 1
    file = dirs.pop
    create_dir(dirs.join("/"))

    pwd = @ftp.pwd
    dirs.each { |dir| @ftp.chdir(dir) }
    @ftp.putbinaryfile(from, file)
    @ftp.chdir(pwd)
  else
    @ftp.putbinaryfile(from, to)
  end
end