Combining all files in folder with ps

Published on den 30 October 2013

This is a simple way I found to combine all textfiles in a folder into a single file using powershell.

In my case I had several exported sql files that I wanted to combine into a single file. First navigate to the current folder with powershell

PS > $query = Get-ChildItem*

PS > $content = Get-Content $query*

PS > Add-Content combined.sql $content*

Voila!

Then feel free to it or if you have any comments or questions mention @MikaelEliasson on Twitter.

CTO and co-founder at Bokio with a background as an elite athlete. Still doing a lot of sports but more for fun.

#development, #web, #orienteering, #running, #cycling, #boardgames, #personaldevelopment