recursive mkdir

mkdir: also create the parent directories if they don't exist.
copy: call mkdir before copy a file to make sure that the directory exists

This patch makes sure that always the complete directory structure exists if we copy a file/directory or create new ones.

@icewind1991, @karlitschek, @blizz or anybody else, please have a look at it. Thanks!