def directory(tmpdir_factory):
    """Create test directory and files."""

    # create test directory and files
    dirs = list()
    files = list()
    for i in range(3):
        d = tmpdir_factory.mktemp('dir{0}'.format(i))
        dirs.append(d)
        for j in range(3):
            f = d.join('file{0}{1}.txt'.format(i, j))
            files.append(f)

    # fill files
    # 1024 bytes
    files[0].write('a' * 1024)                  # 2edc986847e209b4016e141a6dc8716d3207350f416969382d431539bf292e4a
    files[1].write('a' * 1024)                  # 2edc986847e209b4016e141a6dc8716d3207350f416969382d431539bf292e4a
    files[2].write('b' * 1024)                  # 0c66f2c45405de575189209a768399bcaf88ccc51002407e395c0136aad2844d

    # 2048 bytes
    files[3].write('a' * 2048)                  # b2a3a502fdfc34f4e3edfa94b7f3109cd972d87a4fec63ab21a6673379ccf7ad
    files[4].write('a' * 2048)                  # b2a3a502fdfc34f4e3edfa94b7f3109cd972d87a4fec63ab21a6673379ccf7ad
    files[5].write('a' * 1024 + 'b' * 1024)     # d649296e80910172162d1c63a1f82bfc6dd13d2ca9cbf33cc5eb298a9d19a454

    # 2048 bytes
    files[6].write('c' * 2048)                  # 71899db2707c5d7dc62d01bcf923431418374e9fb42a3fcb6d83e5cc017c2173
    # files[7].write('c' * 2048)                  # 71899db2707c5d7dc62d01bcf923431418374e9fb42a3fcb6d83e5cc017c2173
    files[7].write('d' * 2048)                  # 8b2b19289efc06a17436f0eba6ff47737a490560b97f96a9478a942bf41fa399

    # 3072 bytes
    files[8].write('e' * (1024 * 3))            # c307ea816b283f15fe85975fe848908adc52db13f512e2d9407ea8a14baf5c10

    return tmpdir_factory