Skip to content

Instantly share code, notes, and snippets.

@trplll
Created June 27, 2017 20:26
Show Gist options
  • Save trplll/e6a58be6b068982e8a69c51ee491abc8 to your computer and use it in GitHub Desktop.
Save trplll/e6a58be6b068982e8a69c51ee491abc8 to your computer and use it in GitHub Desktop.
Use Powershell to combine multiple SQL Files Into one Text File
$path = "C:\example"
$out = "C:\exampleout.txt"
Get-ChildItem $path -Filter *.sql| % {
$file = $_.Name
" " | Out-File -Append $out
"-----------------------------------" | Out-File -Append $out
"--${file}:" | Out-File -Append $out
" " | Out-File -Append $out
Get-Content $_.FullName | % {
"$_" | Out-File -Append $out
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment