In the following code, Test-Path always return false even though the file does exist. I thought it was the special character in the variable but I use the curly braces to handle that. Still it doesn't work. Can someone help?? Thank you very much!!!
(Get-ChildItem -Path $OriginalRootDir -Recurse -File).FullName |
ForEach-Object {
${In} = "'" + $_ + "'"
${Out} = ${In} -replace "Original", "Converted"
if (-not (Test-Path -Path ${Out} -PathType Leaf))
{
#It always get in here even though the $Out does exist
}
}