Exemplo n.º 1
0
    def get_targets(self, path=None):
        """Return a list of files and/or dirs in path."""
        if not path:
            path = os.getcwd()

        # Determine recursion depth.
        levels = 0
        if self.recursive:
            levels = self.recursivedepth

        targets = []
        for root, dirs, files in helpers.walklevels(path, levels):
            # To unicode.
            root = root.decode("utf-8") + "/"

            if self.dirsonly:
                target = self.get_dirs(root, dirs)
            elif self.filesonly:
                target = self.get_files(root, files)
            else:
                target = self.get_dirs(root, dirs) + self.get_files(root, files)

            targets.extend(target)
            if self.stopupdate:
                return targets

        return targets
Exemplo n.º 2
0
    def get_targets(self, path=None):
        """Return a list of files and/or dirs in path."""
        if not path:
            path = os.getcwd()

        # Determine recursion depth.
        levels = 0
        if self.recursive:
            levels = self.recursivedepth

        targets = []
        for root, dirs, files in helpers.walklevels(path, levels):
            root += "/"
            if self.dirsonly:
                target = self.get_dirs(root, dirs)
            elif self.filesonly:
                target = self.get_files(root, files)
            else:
                target = self.get_dirs(root, dirs) + self.get_files(root, files)

            targets.extend(target)

            # Exit out of get_targets when "Stop" is pressed in the GUI.
            if self.stopupdate:
                return targets

        if self.countcheck:
            return sorted(targets, key=lambda i: i[1] + i[2])
        else:
            return targets
Exemplo n.º 3
0
    def get_targets(self, path=None):
        """Return a list of files and/or dirs in path."""
        if not path:
            path = os.getcwd()

        # Determine recursion depth.
        levels = 0
        if self.recursive:
            levels = self.recursivedepth

        targets = []
        for root, dirs, files in helpers.walklevels(path, levels):
            # To unicode.
            root = root.decode("utf-8") + "/"

            if self.dirsonly:
                target = self.get_dirs(root, dirs)
            elif self.filesonly:
                target = self.get_files(root, files)
            else:
                target = self.get_dirs(root, dirs) + self.get_files(
                    root, files)

            targets.extend(target)
            if self.stopupdate:
                return targets

        return targets