I would like to automatically copy the committed files from svn repository to a certain folder with the same name.
For example, I have svn repository /svn/project1 and after commit it should put all files to /www/project1.
I have a simple post-commit hook script but can’t understand how to get a part of necessary directory (project1):
#!/bin/sh
PROJECTNAME= # how get it?
rm -rf /www/$PROJECTNAME
mkdir /www/$PROJECTNAME
/usr/bin/svn export --force file:///svn/$PROJECTNAME/trunk /www/$PROJECTNAME
You can use Bash parameter expansion:
To get the parent directory requires two steps: