예제 #1
0
    def do_download(self, line):
        # cmd, args, line = self.parseline(line)
        if not line:
            self.help_download()
            return

        args = line.split()
        remote = args[0]

        if len(args) == 1:
            local = remote.split('/')[-1]
        else:
            local = args[1]

        self.download = local
        comm = 'D:' + remote
        SimpleSubShell.default(self, comm)
예제 #2
0
    def do_upload(self, line):

        if not line:
            self.help_upload()
            return

        args = line.split()
        local = args[0]
        try:
            f = open(local, 'rb')
            content = f.read()
            f.close()
        except:
            print("Could not open '%s' file" % local)
            return
        if len(args) == 1:
            remote = local.split('/')[-1]
        else:
            remote = args[1]
        self.upload = local
        comm = ('U:%s:' % remote) + content
        SimpleSubShell.default(self, comm)