Peter Friese

Developer Advocate / Mobile Developer / Public Speaker

Mind-boggling #1: Ant Patternset

If you’re a Windows user like me, you are used to the idea that a filename consist of a first (the name) and a second part (the extension). Recently, I had to write a little Ant file that copies an entire JRE to another directory. In order to do this, I used the following snippet: `

` Now, there is something wrong with this snippet. Can you spot the mistake? I didn’t notice the mistake until my customer complained to me that the timezone information could not be read. It turned out that the timezone information is stored in files without an extension.

But why weren’t they copied? Didn’t I tell Ant to copy all files by specifying “/.”?

No, I didn’t! The pattern “.” means “all files that contain a dot”. Doh. Timezone files do not have a dot. The solution to the problem is quite simple: just remove the “.*”, and you’re done: `


So, if you want to copy all files, remember to not use the “.” notation used to us Windows users, but use the “*” notation used to Linux users.