Created
May 28, 2015 16:29
-
-
Save matt40k/59184a82609ab5b639c3 to your computer and use it in GitHub Desktop.
I've got a some large stored procedures that I've split up into separate files within a subfolder, this script combines them into a single 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
$dir = 'C:\svn\SQL' | |
$dirs = Get-ChildItem -Path $dir –Directory | |
Foreach ($dir in $dirs) { | |
$files = Get-ChildItem $dir.FullName -Filter *.sql | |
Foreach ($file in $files) { | |
$combinedFile = $combinedFile + (Get-Content $file.FullName) | |
} | |
$combinedFile | Set-Content ($dir.FullName + '.sql') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment