def List(device, device_path):
    """Prints a directory listing.

    Args:
      device_path: Directory to list.
    """
    files = device.List(device_path)
    files.sort(key=lambda x: x.filename)
    maxname = max(len(f.filename) for f in files)
    maxsize = max(len(str(f.size)) for f in files)
    for f in files:
        mode = (
                ('d' if stat.S_ISDIR(f.mode) else '-') +
                ('r' if f.mode & stat.S_IRUSR else '-') +
                ('w' if f.mode & stat.S_IWUSR else '-') +
                ('x' if f.mode & stat.S_IXUSR else '-') +
                ('r' if f.mode & stat.S_IRGRP else '-') +
                ('w' if f.mode & stat.S_IWGRP else '-') +
                ('x' if f.mode & stat.S_IXGRP else '-') +
                ('r' if f.mode & stat.S_IROTH else '-') +
                ('w' if f.mode & stat.S_IWOTH else '-') +
                ('x' if f.mode & stat.S_IXOTH else '-'))
        t = time.gmtime(f.mtime)
        yield '%s %*d %04d-%02d-%02d %02d:%02d:%02d %-*s\n' % (
            mode, maxsize, f.size,
            t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec,
            maxname, f.filename)
Prints a directory listing.

    Args:
      device_path: Directory to list.
    
adb/adb_debug.py