def deletefile(self, fileName): if fileName != "": print "Delete file " + fileName self.currentPath = FTP_Client.Connect().printWorkingDir('PWD') FTP_Client.Connect().deleteFileInDirectory('DELE ' + fileName) else: print "No file selected"
def removedirectory(self, fileName): if fileName != "": print "Remove directory " + fileName self.currentPath = FTP_Client.Connect().printWorkingDir('PWD') FTP_Client.Connect().removeDirectory('RMD ' + self.currentPath) else: print "No file selected"
def currentDirectory(self): self.currentPath = FTP_Client.Connect().printWorkingDir('PWD') self.FileTransferSocket = FTP_Client.Connect().makeDataConnection( self.MethodinUse) Reply1, ListOfDirFiles, Reply2 = FTP_Client.Connect().getList( 'LIST ' + self.currentPath, self.FileTransferSocket) return ListofDirFiles, Reply2
def previous(self): print "Previous directory" self.currentPath = FTP_Client.Connect().printWorkingDir('PWD') FTP_Client.Connect().changeToParentDirectory('CDUP') self.currentPath[1:self.currentPath.rindex('/') - 1] reply = FTP_Client.Connect().changeWorkingDirectory('CWD ' + self.currentPath) return reply
def makedirectory(self, fileName): if fileName != "": print "Make directory " + fileName self.currentPath = FTP_Client.Connect().printWorkingDir('PWD') FTP_Client.Connect().makeDirectory('MKD ' + self.currentPath + fileName) else: print "No file selected"
def next(self, fileName): if fileName != "": print "Next directory " + fileName self.currentPath = FTP_Client.Connect().printWorkingDir('PWD') reply = FTP_Client.Connect().changeWorkingDirectory( 'CWD ' + self.currentPath + '/' + fileName) return reply else: print "No file selected"
def servertoclient(self, fileName): #fileName = " NAME" if fileName != "": print "Transfer: Server to client " + fileName self.FileTransferSocket = FTP_Client.Connect().makeDataConnection( self.MethodinUse) FTP_Client.Connect().Retrieve('RETR ' + fileName, self.TypeList, self.FileTransferSocket) else: print "No file selected"
def servertoclient(self, fileName): if fileName != "": print "Transfer: Server to client " + fileName self.FileTransferSocket = FTP_Client.Connect().makeDataConnection( self.MethodinUse) Reply, IncomingData, ElapsedTime = FTP_Client.Connect().Retrieve( 'RETR ' + fileName, self.TypeList, self.FileTransferSocket) return Reply, IncomingData, ElapsedTime else: print "No file selected"
def clienttoserver(self, fileName): if fileName != "": print "Transfer: Client to server " + fileName self.FileTransferSocket = FTP_Client.Connect().makeDataConnection( self.MethodinUse) Reply, IncomingData, ElapsedTime = FTP_Client.Connect().Store( 'STOR ' + fileName, self.TypeList, self.FileTransferSocket) return Reply, IncomingData, ElapsedTime else: print "No file selected"
def clienttoserver(self, fileName): #fileName = " NAME" if fileName != "": print "Transfer: Client to server " + fileName self.FileTransferSocket = FTP_Client.Connect().makeDataConnection( self.MethodinUse) FTP_Client.Connect().Store('STOR ' + fileName, self.TypeList, self.FileTransferSocket) else: print "No file selected"
def blockset(self): self.ModeinUse = 'B' FTP_Client.Connect().changeMode('MODE B', self.ModeList) self.ModeList[0] = False self.ModeList[1] = False self.ModeList[2] = True print "Block mode set"
def streamset(self): self.ModeinUse = 'S' FTP_Client.Connect().changeMode('MODE S', self.ModeList) self.ModeList[1] = False self.ModeList[2] = False self.ModeList[0] = True print "Stream mode set"
def ibset(self): self.TypeinUse = 'I' FTP_Client.Connect().changeType('TYPE I', self.TypeList) self.TypeList[1] = False self.TypeList[0] = False self.TypeList[2] = True print "Image/ Binary type set"
def edcbicset(self): self.TypeinUse = 'E' FTP_Client.Connect().changeType('TYPE E', self.TypeList) self.TypeList[2] = False self.TypeList[0] = False self.TypeList[1] = True print "EDCBIC type set"
def asciiset(self): self.TypeinUse = 'A' FTP_Client.Connect().changeType('TYPE A', self.TypeList) self.TypeList[2] = False self.TypeList[1] = False self.TypeList[0] = True print "ASCII type set"
def compressionset(self): self.ModeinUse = 'C' FTP_Client.Connect().changeMode('MODE C', self.ModeList) self.ModeList[2] = False self.ModeList[0] = False self.ModeList[1] = True print "Compression mode set"
def isValidUser(self, Username, Password, Host, Port): loginStatus = '' if Username != '': loginStatus = FTP_Client.Connect().Login(Username, Password, Host, Port) else: loginStatus = 'Invalid Entry' return loginStatus
def __init__(self): self.MethodinUse = 'PORT' self.TypeinUse = 'A' self.ModeinUse = 'S' self.dataHost = '192.168.1.44' self.dataPort = '7000' self.TypeList = [True, False, False] self.ModeList = [True, False, False] self.Server = FTP_Client.Connect()
def parentdirectory(self): print "Parent directory" reply = FTP_Client.Connect().changeToParentDirectory('CDUP') return reply
def nooperation(self): FTP_Client.Connect().NoOperation('NOOP') print "NOOP"
def parentdirectory(self): print "Parent directory" FTP_Client.Connect().changeToParentDirectory('CDUP')
def nooperation(self): reply = FTP_Client.Connect().NoOperation('NOOP') print "NOOP" return reply
def disconnectServer(self): FTP_Client.Connect().quitService('QUIT')