Couldn't follow symbolic link exception when a file is copied into the home directory

What I want is to copy a single file into the user home directory. What I got till now is always an exception like:

“Could not list contents of ‘/some/random/path/in/my/home/directory’. Couldn’t follow symbolic link.”.

I tested this with a simple gradle project (only one build.gradle file and only one task):

task copyToHomeDir(type:Copy) {
from (‘/path/to/target/dir/’) {
include ‘single.file’
into “${System.getenv(“HOME”)}/”

Maybe it is related to [#GRADLE-1843] Crash on dangling symlink: "Could not list contents of X". Why is Gradle checking stuff like that? I want to copy a singe file to a directory.

Another error occurs when the target directory contains a file or directory that isn’t owned by my user e.g. if I want to copy something in my “${HOME}/Download” folder but a folder that relies unter “${HOME}/Download/tmp/tmp3/something” hasn’t permissions to read:

$ls -la ${HOME}/Download/tmp/tmp3/something
drwxr-xr-x 4 user users 4096 12. Feb 17:25 ./
drwxr-xr-x 27 user users 4096 10. Mai 13:04 …/
d–x–x–x 2 user users 4096 12. Feb 17:25 pkg/

I try it this as well with Gradle 2.8 as also with Gradle 2.14