List contents of remote directory: ls
(self, arg)
| 178 | |
| 179 | # ------------------------[ ls <path> ]------------------------------- |
| 180 | def do_ls(self, arg): |
| 181 | "List contents of remote directory: ls <path>" |
| 182 | path = self.rpath(arg) + self.get_sep(arg) |
| 183 | list = self.dirlist(arg) |
| 184 | cwdlist = [] |
| 185 | # create file list without subdirs |
| 186 | for name in list: |
| 187 | max = len(path.split(c.SEP)) |
| 188 | name = c.SEP.join(name.split(c.SEP)[:max]) |
| 189 | # add new and non-empty filenames to list |
| 190 | if not name in cwdlist and re.sub("^(%.*%)", '', name): |
| 191 | cwdlist.append(name) |
| 192 | # get metadata for files in cwd |
| 193 | for name in cwdlist: |
| 194 | isdir = self.dir_exists(name, list) # check if file is directory |
| 195 | metadata = self.file_exists(name, True) if not isdir else None |
| 196 | if metadata == c.FILE_EXISTS or isdir: # create dummy metadata |
| 197 | (size, otime, mtime) = ('-', conv().lsdate(0), conv().lsdate(0)) |
| 198 | elif metadata != c.NONEXISTENT: |
| 199 | size, otime, mtime = metadata |
| 200 | if metadata != c.NONEXISTENT: # we got real or dummy metadata |
| 201 | output().psdir(isdir, size, otime, self.basename(name), mtime) |
| 202 | else: |
| 203 | output().errmsg("Crippled filename", 'Bad interpreter') |
| 204 | |
| 205 | # ------------------------[ find <path> ]----------------------------- |
| 206 | def do_find(self, arg): |
nothing calls this directly
no test coverage detected