from typing import Counter
import glob


def load_files(folder):
    """Load all text files in folder and return character histogram data and
    files contaning blocked characters."""

    print("Working on %s" % folder)

    # List files containing these chars
    blockchars = "©£€»þ"

    blockfiles = {}
    for char in blockchars:
        blockfiles[char] = []


    # count chars in txt files
    c = Counter()

    for file in glob.glob(folder + "/*/*.txt"):
        with open(file) as f:
            for line in f:
                c += Counter(line)
                for char in line:
                    if char in blockchars:
                        blockfiles[char].append(file)

    return c, blockfiles