It seems that the automatic clean tasks provided by gradle have a bug. If I have a copy task that copies some files to an existing directory and specifys the output of the tasks as follows:
filterRundeckConfig.outputs.files files("…/…/rundeck/rundeck_config/ssl.properties", “…/…/rundeck/rundeck_config/profile”)
gradle cleanFilterRundeckConfig
deletes the directory the files were copied to, not just the files that were copied.