I have the below code:
$files = Get-ChildItem 'C:\SitePlotsA\' -filter '*.csv'
$currentDate = get-date
for ($i=0; $i -lt $files.Count; $i++) {
$outfile = $files[$i].FullName + "out"
$csv = Import-Csv $files[$i].FullName -Delimiter "|"
$newcsv = @()
foreach ( $row in $csv ) {
$row | Add-Member -MemberType NoteProperty -Name "TimeStamp" -Value $currentDate -Force
$newcsv += $row
}
$newcsv | Export-Csv $files[$i].FullName -NoTypeInformation -Delimiter "|"
}
What it does is import all csv files in a given directory and add a new column with the current datetime. It also encapsulates all of my data in double quotation marks "". Is there anyway to have it output this without the double quotation marks? I've looked everywhere.
I want it to stay the way it is by looking at a directory of CSVs and not point to an individual csv.
Thanks!
"Jim ""The Tank"" Brown",27,"Australia"? - Enigmativity"|"as a split, not just the pipe character. If you're not interpreting that data correctly and instead are manually specifying the pipe character as your delimeter in some bespoke interpreation of the data, that's probably the issue? - Adam Parsons