Having trouble matching file with include pattern


(Tyler Wilcock) #1

Hi all. I have the following task:

task cleanDistributions(type: Delete) {
    delete fileTree("distributions").matching {
        include "**/*-LATEST.zip"
    }
}

I’m trying to delete a file located at myproject/lambda/worker/build/distributions/worker-LATEST.zip - however, the above pattern doesn’t work. If I use this instead, it does delete the file:

include "**/*.zip"

However, that’s too general for my liking. I only want to delete zips with the -LATEST postfix. What should my pattern be?


(Tyler Wilcock) #2

Ah, user error…just needed a * at the end of LATEST to match some oddly named files.