next up previous contents index
Next: Chmod Up: Checksum Previous: Parameters specified as nested   Contents   Index

Examples

Example 1

<checksum file="foo.bar"/>
Generates a MD5 checksum for foo.bar and stores the checksum in the destination file foo.bar.MD5. foo.bar.MD5 is overwritten only if foo.bar is newer than itself.

Example 2

<checksum file="foo.bar" forceOverwrite="yes"/>
Generates a MD5 checksum for foo.bar and stores the checksum in foo.bar.MD5. If foo.bar.MD5 already exists, it is overwritten.

Example 3

<checksum file="foo.bar" property="foobarMD5"/>
Generates a MD5 checksum for foo.bar and stores it in the Project Property foobarMD5.

Example 4

<checksum file="foo.bar" verifyProperty="isMD5ok"/>
Generates a MD5 checksum for foo.bar, compares it against foo.bar.MD5 and sets isMD5ok to either true or false, depending upon the result.

Example 5

<checksum file="foo.bar" algorithm="SHA" fileext="asc"/>
Generates a SHA checksum for foo.bar and stores the checksum in the destination file foo.bar.asc. foo.bar.asc is overwritten only if foo.bar is newer than itself.

Example 6

<checksum file="foo.bar" property="${md5}" verifyProperty="isEqual"/>
Generates a MD5 checksum for foo.bar, compares it against the value of the property md5, and sets isEqual to either true or false, depending upon the result.

Example 7

<checksum>
  <fileset dir=".">
    <include name="foo*"/>
  </fileset>
</checksum>
Works just like Example 1, but generates a .MD5 file for every file that begins with the name foo.

Example 8

<condition property="isChecksumEqual">
  <checksum>
    <fileset dir=".">
      <include name="foo.bar"/>
    </fileset>
  </checksum>
</condition>
Works like Example 4, but only sets isChecksumEqual to true, if the checksum matches - it will never be set to false. This example demonstrates use with the Condition task.

Note: When working with more than one file, if condition and/or verifyproperty is used, the result will be true only if the checksums matched correctly for all files being considered.


next up previous contents index
Next: Chmod Up: Checksum Previous: Parameters specified as nested   Contents   Index
Andrew Marlow 2003-07-08