A cleanup Perl script running periodically deletes old log files, and if the folder is empty, it deletes the folder as well. Unfortunately, there is one exception: it should not delete a directory that is symlinked to.
There's no way to tell if there exists a symlink that directly references a dir. (Same for indirect references.)
The best you could do is check every single file on the entire file system, but even that monumental effort wouldn't be perfect. For example, it won't find symlinks on devices that aren't currently mounted, it won't find foreign symlinks to shared portions of the file system, etc.