copy a file or a stream to another file