#!/bin/bash
find . -type d -print0 | while IFS= read -r -d '' dir; do
    find "$dir" -depth -name "*#*" -execdir rename 's/#/_/g' {} +
        find "$dir" -depth -type d -name "*#*" -execdir rename 's/#/_/g' {} +
        done

