In case you need to list directories only in reverse recursive order for automatic list generation for directory removal on package deinstallation, here goes an example sh+find script that should work on all Unix platforms:
#!/bin/sh dirlevel=3; while [ $dirlevel -gt 0 ]; do find /tmp -type d -depth $dirlevel dirlevel=`expr $dirlevel - 1`; done