If your 30/300? csv files contain 10/25? name,value pairs,
combining them in single csv file is not of much use;
unless they are uniform and unique and can thus
be treated as a hash table and converted as input to a [PSCustomObject]
So provided your input csv look like:
|PCone.csv |PCtwo.csv |PChree.csv |
+--------------------+--------------------+--------------------+
|item,value |item,value |item,value |
|machine name,PCone |machine name,PCtwo |machine name,PCthree|
|HD size,250GB |HD size,1TB |HD size,1TB |
|memory,8192 |memory,16384 |memory,16384 |
this script:
## Q:\Test\2019\02\05\SO_54523916.ps1
$Columns = @("machine name","HD size","memory")
$AllCsv = foreach($csv in Get-ChildItem pc*.csv){
[pscustomobject](ConvertFrom-StringData -StringData (
(Get-Content $Csv -raw) -replace ',', "="))
}
$AllCsv | Select-Object $Columns
yields this output:
machine name HD size memory
------------ ------- ------
PCone 250GB 8192
PCthree 1TB 16384
PCtwo 1TB 16384