Sha256: 49ef5779aeac49537eed62f1df0065bbe798549af3bd9dc5f81d1d168756ac1a
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
Titania-0.0.8 | lib/Titania.rb |