fix an issue that copying directory will fail when trying to change file attributes and the target file already exists on remote - the issue was introduced by the commit 84759faa