def get_files(self, path="/"):
        files_dict = {}
        listing = []
        path = os.path.normpath(path)
        cmd = ["ls", "-lRZ", "'" + path + "'"]

        # Get the File object for the top-level path
        # We could not get it otherwise
        files_dict.update(self.get_dir(path))
        # If the device is slow there can be errors produced when running down
        # /proc (ls: /proc/10/exe: No such file or directory) particularly on
        # the emulator. On exception this will just output a string containing
        # all the entries, therefore on error convert output to a list as if
        # nothing happened.
        try:
            listing = subprocess.check_output(self.shell + cmd).split('\n')
        except subprocess.CalledProcessError as e:
            listing = e.output.split('\n')

        # Parse ls -lRZ output for a directory
        # In Android <=6.0 the output of ls -lRZ "<DIRECTORY>" begins
        # with a blank line, in >=6.0.1 it doesn't.
        # This is taken care of when parsing here.
        new_dir = False
        first_run = True
        for line in listing:
            line = line.strip("\r")
            # Skip "total" line
            if line.startswith("total "):
                if first_run:
                    first_run = False
                continue
            # If the current line is empty, expect a new directory in the next
            if not line:
                new_dir = True
                if first_run:
                    first_run = False
                continue
            # Initialise new directory
            if new_dir or first_run:
                directory = line.strip(':')
                new_dir = False
                if first_run:
                    first_run = False
                continue
            # Regular line describing a file
            try:
                f = File(line, directory, self.android_version)
            except ValueError as e:
                if first_run:
                    # If this is the very first line of the output, the
                    # command failed outright
                    self.log.error(e)
                    return None
                self.log.error("In directory \"%s\"", directory)
                self.log.error(e)
            else:
                files_dict[f.absname] = f
        return files_dict
Get the files under the given path from a connected device.
dataset/ETHPy150Open seandroid-analytics/seal/sealib/device.py/Device.get_files