Is there an easy way to copy and modify files at the same time?

view story

http://ubuntuforums.org – I'm trying to keep two java source trees in sync, but they've got different package names, so I'm building a script to copy from one tree to the other. So I want to do a recursive copy, but as I copy the files I want to run them through something like sed to replace package and import names. Is there a clever command line way to do this? (Hardware)