title: Replace all content of file with the content of another file
body: <p>Is there a way to replace all content of a file with the content of another file without destroying the first file?</p>
  
  <p>If I have a file in the current directory called <code>myfile.txt</code>, if I do the following:</p>
  
  <p><code>cp updatedfiles/myfile.txt myfile.txt</code></p>
  
  <p>then my old file is deleted and replaced with a new file (with the same name). I do not want to delete the existing file, I just want to change the content of the file. How to do this?</p>