Hi, I need help removing double quotes in the content of all the files in a directory. I can get it done one file at a time not sure how to do it for all files.
Preformatted texthen trying with all the files in a folder using below. I am not sure if I am doing it right.
Get-ChildItem "C:\Temp" -Filter *.txt |
Foreach-Object {
$content = Get-Content $_.FullName
#filter and save content to the original file
$content | % {$_ -replace '"', ''}
#filter and save content to a new file
$content | Out-File $_.BaseName + '.txt' -En UTF8
}
You’re assigning the content to a variable but you’re not updating the variable after you remove the " so you’re just writing out the content you got. See below:
When you crosspost the same question at the same time to different forums you should at least post links to the other forums along with your question to avoid people willing to help you making their work twice or more.
Hi Matt Bloomfield, Thanks very much for your response. I am now looking at minimizing the process time on these files. I will keep this space updated.
Hi Olaf, Thanks for your response. I wasn’t sure if I could share questions posted on other forums here. I’ll make sure going forward I put all the links here to make it easy.