title: Renaming files after Yeoman copies template files
body: <p>I am working on a sample yeoman generator based on Yeoman's <a href="https://github.com/yeoman/generator-generator" rel="nofollow">generator-generator</a>. The default <code>writing</code> function generated is like this:</p>
  
  <pre><code>generators.Base.extend({
      writing: function () {
          this.fs.copyTpl(
              this.sourceRoot(),
              this.destinationRoot());
      }
  });
  </code></pre>
  
  <p>My template files contain Visual Studio project and solution files so I wish to rename them to match <code>appName</code>:</p>
  
  <pre><code>generators.Base.extend({
      writing: function () {
          this.fs.copyTpl(
              this.sourceRoot(),
              this.destinationRoot(),
              { appname: this.props.appName });
  
          // Rename directory to match 'appName'
          this.fs.move(
              this.destinationPath('foo'), // A directory
              this.detinationPath(this.props.appName)); // From prompt when user types yo webapp
  
          // Rename Visual Studio .sln file to match 'appName'
          this.fs.move(
              this.destinationPath('foo/bar.sln'),
              this.destinationPath(this.props.appName + '/' + this.props.appName + '.sln');
  
         // ...similar renames to Visual Studio .csproj files
      }
  });
  </code></pre>
  
  <p>However, I get an Assertion error at the line that does the first <code>move</code>:</p>
  
  <pre><code>AssertionError: Trying to copy from a source that does not exist
  </code></pre>
  
  <p>I thought the file/directory copying is synchronous but when I ran <code>this.fs.exists(this.destinationRoot())</code> before the first call to <code>this.fs.move</code> it returns <code>false</code>. I suspect it is something to do with <code>this.fs</code> being an instance of an <a href="https://github.com/sboudrias/mem-fs" rel="nofollow">mem-fs</a> where the directory/files only exist in memory until the <code>writing</code> function completes.</p>
  
  <p>What can I do if I need to rename files/directories?</p>