Copy to dist directory fails

Hi All,

I am trying to copy all files and directories from dist/app to the parent directory dist using the task below.

It works only if the directory is different of dist. Why ? What can I do in order it work properly using dist?

I’m using Gradle 4.10.2 under Windows 10.

task copyToParentDir(type: Copy) {
  def tree = fileTree('dist3/app') {
    include '**/*'
  from tree
  into 'dist3'