Getting ANT to scp only new/changed files

Posted by Artem on Stack Overflow See other posts from Stack Overflow or by Artem
Published on 2010-03-29T13:27:25Z Indexed on 2010/03/29 17:13 UTC
Read the original article Hit count: 832

Filed under:
|

I would like to optimize my scp deployment which currently copies all files to only copy files that have changed since the last build. I believe it should be possible with the current setup somehow, but I don't know how to do this.

I have the following:

Project/src/blah/blah/ <---- files I am editing (mostly PHP in this case, some static assets)

Project/build <------- I have a local build step that I use to copy the files to here

I have an scp task right now that copies all of Project/build out to a remote server when I need it.

Is it possible to somehow take advantage of this extra "build" directory to accomplish what I want -- meaning I only want to upload the "diff" between src/** and build/**. Is it possible to somehow retrieve this as a fileset in ANT and then scp that?

I do realize that what it means is that if I somehow delete/mess around with files on the server in between, the ANT script would not notice, but for me this is okay.

© Stack Overflow or respective owner

Related posts about ant

Related posts about scp