예제 #1
0
파일: ftp.py 프로젝트: cmsmith1977/beeswarm
    def do_LIST(self, arg):
        self.respond('150 Listing Files.')
        self.start_data_conn()

        file_names = self.vfs.listdir(self.working_dir)
        for fname in file_names:
            abspath = self.vfs.getsyspath(self.working_dir + '/' + fname)
            self.client_sock.send(path_to_ls(abspath) + '\r\n')
        self.stop_data_conn()
        self.respond('226 File listing successful.')
예제 #2
0
파일: ftp.py 프로젝트: nghiemnv/beeswarm
    def do_LIST(self, arg):
        self.respond('150 Listing Files.')
        self.start_data_conn()

        file_names = self.vfs.listdir(self.working_dir)
        for fname in file_names:
            abspath = self.vfs.getsyspath(self.working_dir + '/' + fname)
            self.client_sock.send(path_to_ls(abspath) + '\r\n')
        self.stop_data_conn()
        self.respond('226 File listing successful.')
예제 #3
0
파일: shell.py 프로젝트: nghiemnv/beeswarm
 def command_ls(self, params):
     if '-l' in params:
         self.writeline('total ' + str(self.total_file_size))  # report a fake random file size
         file_names = self.vfs.listdir(self.working_dir)
         for fname in file_names:
             abspath = self.vfs.getsyspath(self.working_dir + '/' + fname)
             self.writeline(path_to_ls(abspath))
     else:
         listing = []
         for item in self.vfs.listdir(self.working_dir):
             if isdir(self.vfs, os.path.join(self.working_dir, item)):
                 item += '/'  # Append a slash at the end of directory names
             listing.append(item)
         self.writeline(' '.join(listing))
예제 #4
0
 def command_ls(self, params):
     if '-l' in params:
         self.writeline(
             'total ' +
             str(self.total_file_size))  # report a fake random file size
         file_names = self.vfs.listdir(self.working_dir)
         for fname in file_names:
             abspath = self.vfs.getsyspath(self.working_dir + '/' + fname)
             self.writeline(path_to_ls(abspath))
     else:
         listing = []
         for item in self.vfs.listdir(self.working_dir):
             if isdir(self.vfs, os.path.join(self.working_dir, item)):
                 item += '/'  # Append a slash at the end of directory names
             listing.append(item)
         self.writeline(' '.join(listing))