recursive list of sub-directories in reverse order

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:

while [ $dirlevel -gt 0 ]; do
 find /tmp -type d -depth $dirlevel
 dirlevel=`expr $dirlevel - 1`;