title: BASH redirect create folder
body: <p>How can I have the following command</p>
  
  <pre><code>echo "something" &gt; "$f"
  </code></pre>
  
  <p>where <code>$f</code> will be something like <code>folder/file.txt</code> create the folder <code>folder</code> if does not exist?</p>
  
  <p>If I can't do that, how can I have a script duplicate all folders (without contents) in directory 'a' to directory 'b'?</p>
  
  <p>e.g if I have</p>
  
  <p>a/f1/<br>
  a/f2/<br>
  a/f3/</p>
  
  <p>I want to have</p>
  
  <p>b/f1/<br>
  b/f2/<br>
  b/f3/</p>