I think it would be cleaner to do the cd && ant in a subshell:

```
(cd jenkins-artifacts/dists/maven/latest && ant ...)
rm $settingsFile
```