Improve copyfile support
These couple of changes improve the copyfile support, by handling non-existent target directories, and by adding support for source and destination specifications.
AFAIR this was submitted to github, but when the the project got moved to gitlab, the merge was reinstated but then lost in the way. So here it is again. :) I guess !33 (closed) could now be closed.