How would I go about adding any files folders under a given directory to subversion in a batch / pre-commit hook file? (On a Windows system)
I have tried adding the following to a hook file, but nothing under the given path is added.
When I run this from the command line svn appears to go into a loop. What am I doing wrong?
svn add new_file E:\Path\Path\Path*
Thanks in advance
When you pass a folder name to
svn add, the default behavior is to add recursively. Therefore, the commandsvn add E:\Path\Pathwill add that folder and all files/folders inside of it. Subversion won’t recurse into folders that are already under version control, however. For that, you need to add an extra option:svn add E:\Path\Path --force. See [this manual page][1] for more details and examples.One possible problem I can see is that you’ll get an error adding a file if the folder that it lives in isn’t already under version control. In your example, if the folder
E:\Path\Path\hasn’t already been added, then attempting to add any files inside of it will fail. The easiest way to resolve this is tosvn addthe parent folder, which will automatically add everything inside of it as well. If you don’t want to add all of the files in that folder, then you’ll want to split it up into twoaddoperations (one for the folder, and one for files within it):