Clean subprojects build folder from root project

Hello

I need to run clean task of each subproject from root project after uploadArchives task but I can’t figure out how. I read many discussions but I didn’t find anything useful.
Could you help me?
This is my build.gradle in root project:

evaluationDependsOnChildren()

subprojects {
    apply plugin: 'java'

    //  apply plugin: 'maven-publish'
    group = 'my.sample'
    version = '1.0'
    repositories { mavenCentral() }
    dependencies { testCompile "junit:junit:4.12" }
    repositories {
        flatDir name: 'libs', dirs: "$projectDir/../myFolder/libs"
    }

    uploadArchives {
        repositories { add project.repositories.libs }
    }
}

task publishToMyFolder {
    // clean all subproject build after uploadArchives
    doLast{
        subprojects.each { subproject ->
            // clean subproject build folder            
        }
    }
}

publishToMyFolder.dependsOn(subprojects.uploadArchives)


defaultTasks 'publishToMyFolder'