On Dir is a program that automatically executes scripts as you traverse
directories at a terminal.

In addition to executing scripts in the directory you are entering or leaving,
ondir also executes scripts in directories that are traversed on the way to that
directory.

WWW: http://swapoff.org/ondir.html