copy some contents to a file