title: Shell script to create directories and files from a list of file names
body: <p>I'm (still) not a shell-wizard, but I'm trying to find a way to create directories and files from a list of file names.</p>
  
  <p>Let's take this source file (<code>source.txt</code>) as an example:</p>
  
  <pre><code>README.md
  foo/index.html
  
    foo/bar/README.md
  foo/bar/index.html
  
  foo/baz/README.md
  </code></pre>
  
  <p>I'll use this command to remove empty lines and trim useless spaces:</p>
  
  <pre><code>$ more source.txt | sed '/^$/d;s/^ *//;s/ *$//'
  </code></pre>
  
  <p>It will give me this list:</p>
  
  <pre><code>README.md
  foo/index.html
  foo/bar/README.md
  foo/bar/index.html
  foo/baz/README.md
  </code></pre>
  
  <p>Now I'm trying to loop on every line and create the related file (it it doesn't already exists), with it's parents directories.</p>
  
  <p>How could I do this?<br>
  Ideally, I would put this script in an alias to quickly use it.</p>