Color prompt with file numbers does not work anymore

I have used this color prompt on my servers for long time, in file ~\.bashrc

Black="\[\e[0;30m\]"
Dark="\[\e[Gray 1;30m\]"
Blue="\[\e[0;34m\]"
LBlue="\[\e[1;34m\]"
Green="\[\e[0;32m\]"
LGreen="\[\e[1;32m\]"
Cyan="\[\e[0;36m\]"
LCyan="\[\e[1;36m\]"
Red="\[\e[0;31m\]"
LRed="\[\e[1;31m\]"
Purple="\[\e[0;35m\]"
LPurple="\[\e[1;35m\]"
Brown="\[\e[0;33m\]"
Yellow="\[\e[1;33m\]"
LGray="\[\e[0;37m\]"
White="\[\e[1;37m\]"
Reset="\[\e[0m\]"
PS1="$Yellow\u@\h $LBlue\w $LGreen[$(ls | wc -l):$(($(ls -ad .* | wc -l)-2))]\$([ \$? = 0 ] && echo -e '$LGreen#$Reset' || echo -e '$LRed#$Reset'\)"

It gives a prompt like this

root$faster \tmp [5:2]#

The numbers [5:2] tells me there are 5 normal files and 2 hidden .

For some reason this does not work anymore when I change directory. I am not sure when this has stopped working. If run the PS1 variable manually, it updates the file number, but this should go automatically.
Anyone could test this as see if it works or not.
I do run my server on Ubuntu 32 and 64 bits 12.04

You are missing a backslash:

PS1="$Yellow\u@\h $LBlue\w $LGreen[\$(ls | wc -l):$(($(ls -ad .* | wc -l)-2))]\$([ \$? = 0 ] && echo -e '$LGreen#$Reset' || echo -e '$LRed#$Reset'\)"

Thanks you for looking at this, but your solution broke other stuff. It now shows correct visible files in a folder.
This part $(($(ls -ad .* | wc -l)-2)) does not more list the hidden files. Test in home folder.

\$([ \$? = 0 ] && echo -e '$LGreen#$Reset' || echo -e '$LRed#$Reset'\)
Exit code no longer change color on # from green to red when some is wrong.

\$(($(ls -ad .* | wc -l)-2))
This works some, but only give correct number of files when its run.
Changing folder does not update the numbers.

---------- Post updated at 09:49 ---------- Previous update was at 09:08 ----------

New version that do work. (did copy some from internet)

function exitstatus {

    Exit="$?"
	Black="\[\e[0;30m\]"
	Dark="\[\e[1;30m\]"
	Blue="\[\e[0;34m\]"
	LBlue="\[\e[1;34m\]"
	Green="\[\e[0;32m\]"
	LGreen="\[\e[1;32m\]"
	Cyan="\[\e[0;36m\]"
	LCyan="\[\e[1;36m\]"
	Red="\[\e[0;31m\]"
	LRed="\[\e[1;31m\]"
	Purple="\[\e[0;35m\]"
	LPurple="\[\e[1;35m\]"
	Brown="\[\e[0;33m\]"
	Yellow="\[\e[1;33m\]"
	LGray="\[\e[0;37m\]"
	White="\[\e[1;37m\]"
	Off="\[\e[0m\]"
	Files="[$(ls | wc -l):$(($(ls -ad .* | wc -l)-2))]"

    Prompt="${Yellow}\u@\h ${LBlue}\w ${LGreen}${Files}"

    if [ "${Exit}" -eq 0 ]
    then
       PS1="${Prompt}${LGreen}#${Off}"
    else
       PS1="${Prompt}${Red}#${Off}"
    fi
}

PROMPT_COMMAND=exitstatus

It didn't.
The other stuff was already broken given the fact I didn't change anything elsewhere and my change doesn't impact but the number of non hidden files displayed.

Fixed it. Used some hour to get it correct

PS1='\[\e[1;33m\]\u@\h \[\e[1;34m\]\w $(es=$?; [[ $es -ne 0 ]] && echo "\[\e[1;31m\]" || echo "\[\e[1;32m\]")[$(ls | wc -l):$(($(ls -ad .* | wc -l)-2))]\$\[\e[0m\]'

Normal exit
root@server2 /etc [172:1]#

Error exit
root@server2 /etc [172:1]#