示例#1
0
    def onListfiles(self):
        # list files on server
        self.filelist = []
        print("File List:")
        cmd = "list" 
        self.socket.send(cmd + "\r\n")
        f = self.socket.makefile('r')

        while 1:
            code = self.getreply(f)
            print("code = %s"  % code)
            if code in ('221', 'EOF'):
                self.socket.send("quit" + "\r\n")
                break
            if code == '150':
                self.getfilelist(self.dataport)
                code = self.getreply(f)

            if self.data_transfer_done == 1:
                self.data_transfer_done = 0
                break

        Form.onListfiles(self, self.filelist)
示例#2
0
    def onListfiles(self):
        # list files on server
        print("File List:")
        self.filelist = os.listdir(DIRNAME)

        Form.onListfiles(self, self.filelist)