powershell copy all files from one folder to another code example
Example 1: copy contents of multiple files to one file powershell
Get-ChildItem d:\scripts -include *.txt -rec | ForEach-Object {gc $_; ""} | out-file d:\scripts\test.txt
Example 2: powershell script to copy mutliple files into a single file
PS C:\temp> $mergeFile = "c:\temp\merged.file" # path/name of your merge file
PS C:\temp> Get-ChildItem -Filter *.txt | foreach {
$_.fullname | out-file $mergeFile -Append # append current file name to merge file
get-content $_.fullname | out-file $mergeFile -Append # append current file content}