I have a build script that does a number of things (minimize javascript, upload to amazon s3 etc). The minimize ANT task only operates on the javascript that I have modified and ignores the rest (I didn't write this script). I would like to do something similar for the amazon s3 task where only the updated content is upload in the task. Any leads on how to do this would be greatly appreciated.
In general you can do this for tasks that have source and destination files using File Mappers, so that the task is only applied to source files that have changed. I don't know if there's a way to do something where Ant cannot see the destination files, like uploading.
Provided you don't want to change/rewrite the S3 task and want to stay purely in XML, you could use the Uptodate Task and a shadow directory to mimic this behaviour - e.g. keep a copy of your uploads (potentially huge) or just an empty file with the creation date of the last time you uploaded. The examples on the manual page should provide a lot of hints where to go.
Of course you could write your own S2Uptodate task as well, connecting to S3 to compare the dates. The preferred solution depends upon how many files there are (e.g. a few huge ones where you'd be able to check each one in a distinct operation or a near infinite number of small ones that you'd tackle differently.
You might also get inspired by the Xjc task's usage of and elements, though this of course operates purely on local files.
You can select a fileset with a modified date tag. The modified tag is insanely powerful, so check it out: Ant Selectors - Modified.
In order for it to tell what has changed, it can keep a cache in a property file, which updates after each successful build, unless you use the delayupdate attribute - so perhaps to test it, you can have:
<param name="commitUpdate" value="false" />
[...]
<ftp ...>
<fileset dir="src">
<modified delayupdate="${commitUpdate}" />
</fileset>
</ftp>
And of course you could set that commitUpdate via a command-line param or something.