' ' SvnSetProps.vbs - A script to recursively set Subversion properties on files ' Author: Nick Heppleston (nick@modhul.com) - http://www.modhul.com ' Version 0.1 - 22nd October 2007 ' ' This work is licensed under a Creative Commons Attribution 2.5 License - you can use commercially ' and modify as necessary, but you must give the original author credit. Furthermore, this script ' is provided “AS IS” with no warranty. Further information regarding this licence can ' be found online at: http://creativecommons.org/licenses/by/2.5/ ' Dim objFSO Dim ofolder Dim logFileStream Dim searchFileExt Dim searchDir Dim svnProp Dim pretend Dim Args Set Args = WScript.Arguments WScript.Echo "Pretend: "& Args(0) WScript.Echo "Propset Value: "& Args(1) WScript.Echo "File Ext: "& Args(2) WScript.Echo "Path: "& Args(3) Set objFSO = CreateObject("scripting.filesystemobject") 'svnProp = "svn:needs-lock true" 'svnProp = "svn:mime-type application/octet-stream" pretend = Args(0) svnProp = Args(1) searchFileExt = Args(2) searchDir = Args(3) SetPropsRecursive (objFSO.getfolder(searchDir)), logFileStream, searchFileExt, svnProp, pretend Sub SetPropsRecursive (objCurrentFolder, objLogFile, strSearch, svnProp, pretend) Dim strTemp Dim strOutput Dim objNewFolder Dim objFile Dim objStream Dim oShell Dim fileCount For Each objFile In objCurrentFolder.Files strTemp = Right(objFile.Name, 4) If UCase(strTemp) = UCase(strSearch) Then fileCount = fileCount + 1 End If Next If fileCount > 0 Then Set oShell = WScript.CreateObject ("WSCript.shell") WScript.Echo "" WScript.Echo "Entering directory: "& objCurrentFolder.Path For Each objFile In objCurrentFolder.Files strTemp = Right(objFile.Name, 4) If UCase(strTemp) = UCase(strSearch) Then WScript.Echo " - Setting property """& svnProp &""" on: "& objFile.Name ' Only run the property-set command if the pretend flag is not set. If not pretend Then oShell.run "svn propset "& svnProp &" """ & objFile.Path &"""" End If End If Next Set oShell = Nothing End If 'Recurse through all of the folders For Each objNewFolder In objCurrentFolder.subFolders SetPropsRecursive objNewFolder, objLogFile, strSearch, svnProp, pretend Next End Sub