How to match a filename with a tilde using FileTree class

I’m trying to match a filename in my local directory that ends with a tilde. The FileTree class does not appear to handle this case.

FileTree tree = fileTree(’.’) {
include ‘*~’

tree.each { File file -> println file }

Any ideas on how to match a filename with a tilde in it? Thanks!

It’s the same problem described here:

and here:

For backwards compatibility, we’re stuck with using the default Ant excludes in all PatternSets. One of the exclusions is ‘**/*~’. The JIRA ticket describes a workaround, basically, you have to remove the global exclusion.