Created
June 27, 2017 20:26
-
-
Save trplll/e6a58be6b068982e8a69c51ee491abc8 to your computer and use it in GitHub Desktop.
Use Powershell to combine multiple SQL Files Into one Text File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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