0

I understand Grails 3 uses gradle for scripting, I'm trying to delete the files in a directory, but I can't accomplish it.

If I type delete "grails-app/assets/stylesheets/a.css it works

but if I try something like delete "grails-app/assets/stylesheets/*.css it does nothing.

Any idea why?

  • There are a lot of answers in google. The first of them (by keywords "gradle delete files wildcard"): http://stackoverflow.com/questions/27285885/gradle-delete-files-with-certain-extension – wwarlock Jan 16 '17 at 10:23
  • I've tried those before posting, but none of that worked. – Pepe Juarez Jan 17 '17 at 03:29

1 Answers1

0

Just tried the method from the link I've posted as the comment. I've added the next lines and all works perfectly.

task deleteFiles(type: Delete, group: "StackOverflow example") {
    delete fileTree("$projectDir/grails-app/assets/stylesheets/") {
        include '**/*.css'
    }
}

You may also delete files without subdirs recursion if you needed.

include '*.css'

You may even write any Groovy/Java code in the Gradle script to do that task in other way if you don't like it.

wwarlock
  • 443
  • 4
  • 14