I want to copy a range of files and whole directories to another directory in a single Copy task. I can copy individual files, and the contents of directories, but how do I copy the directory itself?
This is my task:
task myTask(type: Copy) {
from 'path/to/file'
from 'path/to/dir'
into 'path/to/target'
}
which copies the file OK, but only the files in the dir. I want to end up with the contents of the dir in path/to/target/dir (not in path/to/target).
I found a work around by using:
task myTask(type: Copy) {
from 'path/to/file'
from 'path/to'
into 'path/to/target'
include 'dir'
}
But that is prone to name collisions. I actually have many files and dirs to copy, and I want to make it one task.