import/combine two csv files

Sorry I was pulled away on another instance, thank you both Rob and Stephen. I worked with both scripts and they perform well however the format is not what I need unfortunately. However I have this script that combines/joins the two csv files line by line but it has a function flips 2 lines after a given number of lines are counted. My question: Is it possible to modify this script so that it doesn’t manipulate any lines. A script that would just combine these to csv files line for line.

$lines1 = Get-Content “D:\scripts\audit.csv”
$lines2 = Get-Content “D:\scripts\drive.csv”
$destination = “D:\scripts\test.csv”

$length = [Math]::Min($lines1.Length, $lines2.Length) <–flagging?
for ($index = 0; $index -lt $length; $index++)
{

Append rows

Add-Content $destination ($lines1[$index] + "," + $lines2[$index]) <–flagging?
}

James,

Would it be possible to post examples of the 2 input files - with 3 or 4 dummy data entries as well as a desired output file with that data?

I think I am not fully understanding your requirements with the “function flip” etc

Is it possible to attach a sample of the files for the columns on each are very long. The output on this page doesn’t allow it to look normal

 

After look at the examples you provided me my issue was with my script that was scanning the drives. I added the values ComputerName as suggested by Rob and ran the scripts and all data and lines are matching. Thanks for your time and advice to get me on the right track!