Powershell unites csv's

I have a simple batch of script that copies multiple csv files into one csv and I cannot find a way to do the same in powershell with comparable speed. In batch mode, it looks like this:

Copy "* .csv" Merged.csv

It copies approximately 20 3 MB csv to one file in a few seconds.

The closest I came to powershell:

dir * .csv | Import-Csv | Export-Csv allsites.csv -NoTypeInformation

This method takes a lot of time. Can a method in powershell be comparable in speed to the DOS command above?

+5
source share
1 answer

This should do the same as the DOS command.

(get-content *.csv) | set-content Merged.csv

But each of them will have additional header lines in the result file.

+5
source

All Articles