I want to copy the csv files from two different servers and then paste those files at some location on 3rd server.
CSV File location on 1st server is –
E:\HC_Disk\Sample\"+"DiskSpace-"+(Get-Date -format yyyyMMdd)+".csv
CSV file location on 2nd server –
E:\HC_Disk\Sample\"+"DiskSpace-"+(Get-Date -format yyyyMMdd)+".csv
I have the script which generates the files everyday. My main concern is to club the two files together in the powershell.
Can you please help me with that. Thanks
Answer
If you’re referring to merging two CSVs, assuming the same headers, try below (modify for your filenames/paths):
Get-Content file1.csv, file2.csv | Select-Object -Unique | Set-Content mergedfile.csv
Attribution
Source : Link , Question Author : Haninder Cheema , Answer Author : bentek