Corion already commented on the problem you noted, but there's another: your $PathOnly is in double quotes, so the backslashes there are interpreted as escape sequences.
Also, should you ever be in need of a string consisting of a single backslash, you could use
"\N{REVERSE SOLIDUS}" (prior to v5.16, you have to
use charnames explicitly for this to work). That is complicated, but whoever reads that, will have no doubt that you indeed want a single backslash that is not part of an escape secuence.