def walk_dir_animated(path, maxdircnt=1000):
    """ Walk a directory, printing status updates along the way. """
    p = AnimatedProgress(
        'Walking {}...'.format(path),
        frames=Frames.dots_orbit.as_rainbow(),
        show_time=True,
    )
    rootcnt = 0
    print('\nStarting animated progress.')
    with p:
        for root, dirs, files in os.walk(path):
            rootcnt += 1
            if rootcnt % 50 == 0:
                p.text = 'Walking {}...'.format(C(root, 'cyan'))
            if rootcnt > maxdircnt:
                # Stop is called because we are printing before the
                # AnimatedProgress is finished running.
                p.stop()
                print('\nFinished walking {} directories.'.format(
                    C(maxdircnt, 'blue', style='bright')
                ))
                break
        else:
            # AnimatedProgress still running, `stop` it before printing.
            p.stop()
            print_err('\nNever made it to {} directories ({}).'.format(
                C(maxdircnt, 'blue', style='bright'),
                C(rootcnt, 'red', style='bright'),
            ))
    print('\nFinished with animated progress.')
    return 0
Walk a directory, printing status updates along the way.