Thursday, March 17, 2016

Setting SVN Keywords property recursively using PowerShell

Here is a PowerShell script that allows you to set SVN keywords proeprty for .cs files.  I confess this isn't written by me, and I got it from a forum which I can't remember where.  Nonetheless, I would like to share it in case it is useful to others too.

param([string]$path)

Get-ChildItem $path -Recurse -Include *.cs | Where-Object {
        (Get-Content $_.FullName) -match '\$Id'
      } | ForEach-Object {
        svn propset svn:keywords "HeadURL Id Author LastChangedBy LastChangedRevision LastChangeDate Revision Rev" $_.FullName
      }