Use single quotes with double back slash, and you will not get any error.

    touch ~/deleted/$(echo "directory_"$(readlink -f foo)|tr '/' '\\')