示例#1
0
 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"
示例#2
0
 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"
示例#3
0
 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
示例#4
0
 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
示例#5
0
 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"
示例#6
0
 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"
示例#7
0
 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"
示例#8
0
 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"
示例#9
0
 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"
示例#10
0
 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"
示例#11
0
 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"
示例#12
0
 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"
示例#13
0
 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"
示例#14
0
 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"
示例#15
0
 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"
示例#16
0
 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"
示例#17
0
 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
示例#18
0
 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()
示例#19
0
 def parentdirectory(self):
     print "Parent directory"
     reply = FTP_Client.Connect().changeToParentDirectory('CDUP')
     return reply
示例#20
0
 def nooperation(self):
     FTP_Client.Connect().NoOperation('NOOP')
     print "NOOP"
示例#21
0
 def parentdirectory(self):
     print "Parent directory"
     FTP_Client.Connect().changeToParentDirectory('CDUP')
示例#22
0
 def nooperation(self):
     reply = FTP_Client.Connect().NoOperation('NOOP')
     print "NOOP"
     return reply
示例#23
0
 def disconnectServer(self):
     FTP_Client.Connect().quitService('QUIT')