I was thinking about how I often end up in a directory path where the names of one or more components repeat. It seemed there should be a name for when this happens.

/home/joey/src/ikiwiki/doc/ikiwiki/
/home/joey/src/pdmenu/src/
/home/joey/src/joeywiki/joey/
/lib/modules/2.6.26-2-686/kernel/lib/
/proc/1/task/1/

Then I realized there was a name already: Fractal. While directory structures are supposedly hierarchical, different levels in the hierarchy are self-similar, and so sometimes the same name is duplicated, with a subtly, or vastly different meaning, at different levels in the same directory path.

I had wondered if we were doing something wrong, that this happens so often. It is occasionally confusing. But aside from using a deep, nominally hierarchical directory structure, and displaying a slice through it (as if talking about electron orbitals in a rock orbiting sol), I don't think we're doing anything wrong.

Here is a oneliner that will find all such directories inside a specified start directory. You will probably find some amusing ones you've never noticed.

perl -MFile::Find -le 'find(sub { if (-d $_) { my %bits; foreach $bit (split "/", $File::Find::name) { if (++$bits{lc($bit)} > 1) { print $File::Find::name; return } } } } , shift || ".")'