Exemplo n.º 1
0
    def walkdir(self, path=None):

        if not os.path.exists(path):
            return

        for root, dirs, files in os.walk(path):

            if self.include:
                files = filter(lambda x: self.include in x, files)

            if self.exlude:
                files = filter(lambda x: not self.exlude in x, files)

            for item in files :
                fragment = os.path.relpath(os.path.join(root, item), path)
                yield (
                    os.path.join(self.path, fragment),
                    deslugify(os.path.splitext(item)[0]),
                )
    def walkdir(self, path=None):
        output = list()

        if not os.path.exists(path):
            return None

        for root, dirs, files in os.walk(path):

            if self.include:
                files = filter(lambda x: self.include in x, files)

            if self.exlude:
                files = filter(lambda x: not self.exlude in x, files)

            for item in files:
                output += ((os.path.join(self.path, item), deslugify(os.path.splitext(item)[0])),)

            for item in dirs:
                output += self.walkdir(os.path.join(root, item))

        return output
    def walkdir(self, path=None):
        output = list()

        if not os.path.exists(path):
            return None

        for root, dirs, files in os.walk(path):

            if self.include:
                files = filter(lambda x: self.include in x, files)

            if self.exlude:
                files = filter(lambda x: not self.exlude in x, files)

            for item in files :
                output += ( (
                    os.path.join(self.path, item),
                    deslugify(os.path.splitext(item)[0]),
                ),)

            for item in dirs :
                output += self.walkdir(os.path.join(root, item))

        return output