I use a tstamp to build a fileset of old files to delete. This has been working well, but since around the start of the month it fails.
The error is:
Date of 08/09/2021 01:25 PM Cannot be parsed correctly. It should be in MM/DD/YYYY HH:MM AM_PM format.
<target name="RemoveOldBackups" >
<tstamp>
<format property="BKRetention" pattern="MM/dd/yyyy hh:mm a" locale="en,UK" offset="-${Backup.Retention.Number}" unit="${Backup.Retention.Unit}"/>
</tstamp>
<for list="${Database.List}" param="database" parallel="${parallel}" threadCount="${threadCount}">
<sequential>
<echo message="Working on Database: @{database} Full path: ${Database.List.@{database}.Location}${Database.List.@{database}.FileName}" />
<delete>
<fileset dir="${Database.List.@{database}.LocalBackup}" includes="**/*.bkp">
<date datetime="${BKRetention}" when="before"/>
</fileset>
</delete>
</sequential>
</for>
</target>
The script itself hasn't changed in that time period, so it must be something environment related.
After further investigation I established that the machine was running a version on Ant from 2012. After updating to the latest release the problem is fixed.