require "net/ftp" require "Titania/version" module Titania class Connection attr_accessor :connect def initialize(host,username,password) self.connect = Net::FTP::new(host, username, password) end def get_list(path = '/') # File List / Return Array result = self.connect.list(path) end def current_dir # get current dir self.connect.pwd end def change_dir(path) # Change dir self.connect.chdir(path) end def delete_file(path, file_name) # Delete file self.connect.delete(path + "/" + file_name) end def create_dir(path, dir_name) # Create dir self.connect.mkdir(path + "/" + dir_name) end def help(argv = nil) # Help cmd = "HELP" if argv cmd = cmd + " " + argv end self.connect.sendcmd(cmd) end def change_name(f_name, c_name) # Change file or directory name self.connect.rename(f_name, c_name) end def remove_dir(dir) # Remove dir self.connect.rmdir(dir) end def file_size(file) # Get File Size self.connect.size(file) end def connection_status # Connection status if self.connect.closed? puts "Connection is closed !" else puts "Connection is active !" end end def close # close connection self.connect.close end end end