title: Is there a way to make mv create the directory to be moved to if it doesn't exist?
body: <p>So, if I'm in my home directory and I want to move foo.c to ~/bar/baz/foo.c , but those directories don't exist, is there some way to have those directories automatically created, so that you would only have to type</p>
  
  <pre><code>mv foo.c ~/bar/baz/ 
  </code></pre>
  
  <p>and everything would work out? It seems like you could alias mv to a simple bash script that would check if those directories existed and if not would call mkdir and then mv, but I thought I'd check to see if anyone had a better idea.</p>