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.')
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.')
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))
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))