title: How to uglify multiple .js files in a folder and output them to a different folder?
body: <p>I'm new to grunt, and I can't figure out how to define paths when using the plugin <code>grunt-contrib-uglify-es</code>.</p>
  
  <p>This is my folder structure :</p>
  
  <pre class="lang-none prettyprint-override"><code>.
  ├── controllers
  ├── models
  ├── public
  │   ├── build
  │   │   ├─ foo.min.js
  │   │   └─ x.min.js
  │   ├── css
  │   ├── font
  │   └── js
  │        ├─ foo.js
  │        └─ x.js
  ├── routes
  ├── tests
  ├── utils
  └── views
  </code></pre>
  
  <p>and this is my grunt task :</p>
  
  <pre class="lang-js prettyprint-override"><code>// take all js file in public/js/ and put them in public/build/
  uglify: {
    options: {
      mangle: false,
            banner: '/*! &lt;%= pkg.name %&gt; &lt;%= grunt.template.today("yyyy-mm-dd") %&gt; */\n'
    },
    build: {
      files: [{
        expand: true,
        src: 'public/js/*.js',
        dest: 'public/build/',
        rename: function (dst, src) {
          console.log(dst);
          console.log(src);
          return src;
        }
      }]
    }
  }
  </code></pre>
  
  <p>When I run grunt, it creates the file(s) into <code>public/js</code> and overwrites the existing file(s). I don't understand why.</p>
  
  <p>I also tried this :</p>
  
  <pre class="lang-js prettyprint-override"><code>expand: true,
  src: 'js/*.js',
  dest: 'build/',
  cwd: 'public/',
  </code></pre>
  
  <p>And now it create a new folder <code>js</code> at the root with all the files inside.</p>
  
  <p>I would like to compress every <code>.js</code> file in <code>public/js/</code> and then put them in <code>public/build/</code></p>
  
  <p>I'm clearly lost, can you help me please?</p>