GEORGE TRIFONOV Home Developer Corner Contact Resume 
Theme
Login
 
 
PowerShell file concatenation example.Get-content,Set-content code snippet

Once you got how to copy one or several files, another common task is to concatenate several files from one directory and copy result to another. Find here how simple to do this with PowerShell -

   1: #PowerShell file concatenation example
   2:  
   3: # all text files from directory
   4: $source = "c:\dir\*.txt"
   5: #destination folder
   6: $dest ="d:\destination"
   7:  
   8: #adding content from all files matched files from destination directory to source file
   9:  add-content -path $dest -value (get-content $source)

 

For additional parameters see http://technet.microsoft.com/en-us/library/bb978714.aspx

Share this post: email it! | bookmark it! | digg it! | kick it! | live it!
Posted: Thu, 17 Apr 2008 14:44:59 GMT By: Gtrifonov