Search

about
article
documents
projects

Audio
Images
Software
Travel
Video

Hey Tiger
It's like musical pop rocks in your jack and coke!

Kristin Hoffmann
Voice. Piano. Guitar.

s-s-s-spectres
Just like Dad's beer can collection, except without the dust... and louder.

Asako Kohno
J-Power

c2677
Some links are stronger than others

Ant Clean Timestamps

An ant task that compares two file trees and will update modification timestamps in one tree (src) to match the other (target). Updates will only occur on files that differ in content.

Creative Commons GNU GPL

The following ant task will read two source trees and compare them. The file modified timestamps in the src tree will be compared to a corresponding file in the dest tree. If the timestamps and the file contents differ while ignoring whitespace, then the dest file’s last modified date will get updated with the timestamp of the src file.

The end result is that you get two file trees where any matching files that have the same content, will also have the same timestamps.

Releases:
AntCleanTimestamps 1.0

Usage: I recommend that you run the ant task at least once with the “pretend” option turned on at least once to make sure that the files you expect to be updated are the ones that are actually being affected. There is also a “debug” option which will print a little bit more information.

To use the ant task just place code like the following in your build.xml file:

<?xml version="1.0"?>
<project name="AntCleanTimestamps" default="clean-timestamps" basedir=".">
    <description>
        build.xml file for AntCleanTimestamps.
    </description>
    <!-- some global properties -->
    <property name="src" location="src-folder" />
    <property name="target" location="target-folder" />
    <target name="clean-timestamps">
        <typedef name="diff" classname="com.pauloswald.ant.cleantimestamps.AntCleanTimestamps">
            <classpath>
                <pathelement location="..distAntCleanTimestamps.jar" />
           </classpath>
        </typedef>
        <diff pretend="true" debug="false" src="${src}" target="${target}" />
    </target>
</project>

License: This code is released under the GPL. The source code, license, and readme are all packed inside the jar. I would also ask that if you find any bugs or issues with the code, please email me. You can find my most current contact info on this site.