I've never utilised Powershell before but I'm trying to set up an easy way of removing text qualifiers that might cause skewing ( " / ' / "/,) while not having to manually go into each file to remove them. These files are either in .txt or .csv format.
Would like it to basically loop through all files at a in a filepath, remove the text qualifiers and then save the files.
Sample:
ID |Description |Date
================================
0001|"xasfdsghdfshdf"|05/02/2022
0002|abc "xyz" abc |31/01/2022
0003|abcde" |01/02/2022
0004|" |01/06/2022
Expected output:
ID |Description |Date
==============================
0001|xasfdsghdfshdf|05/02/2022
0002|abc xyz abc |31/01/2022
0003|abcde |01/02/2022
0004| |01/06/2022
Found a bit of script in an archive that ~should~ technically do this, but for the life of me I can't make it work. Would much appreciate any help! :)
$Folder = (Get-ChildItem -Path "YOUR_FOLDER_HERE" -Recurse -Filter *.CSV).FullName
foreach ($File in $Folder) {[System.IO.File]::WriteAllText("$File", [System.IO.Files]::ReadAllText("$File").Replace("`"",""))}
# Method 1 - Non-scalable
###foreach ($File in $Folder) { (Get-Content $File).replace("""," ") | Set-Content $File }