I'm not familiar with unison, but it probably can use recursion. I know rsync definitely does. Use Perl if you want, but it's not the only language that allows utilities to be written that recur through directories. Several utilities already exist which do that.