Delete directory content from Gradle

Viewed 149

I use this Gradle configuration to copy generated asciidoc files.

But I need to delete old outdated files also.

task copyDocument(type: Copy) {
    dependsOn bootJar

    from file("build/docs/asciidoc/")
    into file("src/main/resources/static/")
}

How I can delete the content of directory src/main/resources/static/ before I paste the new generated files?

1 Answers
task copyDocument(type: Copy) {
    dependsOn bootJar

    from file("build/docs/asciidoc/")
    into file("src/main/resources/static/")
    doFirst {
        delete "build/folder"
    }
}
Related