Replacing an application bundle using cp

I’m trying to build in an auto-updater for a script I’m wanting to distribute to co-workers, and I’m having trouble.

I like how the “cp” shell script will allow you to copy and rename a file at the same time, as in

do shell script "cp SourceFile.txt TargetFile.txt"

What I’m trying to achieve is to allow for the fact some people may rename the script file on their computer, and I want the auto-update to preserve their filename. I can grab their old filename and place it into the “TargetFile” portion of the cp command. That works fine so long as I’m saving the script “as application”, but when I save the scripts as “Application Bundles”, the command fails (“Finder got an error: cp /path/to/my/ is a directory (not copied)”) I presume because the file to copy is a bundle (which is really just a directory). The newer version file is on an XServe server, so I’m thinking it’s because unix is not seeing the difference in a bundle and a directory in this case.

As it stands now, if I do cp -r, I get one bundle placed inside another (because from what I’ve read about cp, if the cp command has two directories listed, it copies the first one listed INSIDE the second one.), and if I just use cp alone I get an error (“Finder got an error: cp /path/to/my/ is a directory (not copied)”).

Is there a way to get my Application Bundle to copy the new version off the server, and rename and replace the old version using cp?