title: How to copy all files within a directory with globstar?
body: <p>Say I want to copy all files within <code>dir</code> to <code>dest</code>:</p>
  
  <pre><code>$ tree .
  .
  ├── dest
  └── dir
      ├── dir
      │   ├── file1
      │   └── file2
      └── file3
  </code></pre>
  
  <p>This is easy if I know the filenames and the directory depths:</p>
  
  <pre><code>$ echo dir/f* dir/*/*
  dir/file3 dir/dir/file1 dir/dir/file2
  
  $ cp dir/f* dir/*/* dest/
  
  $ tree dest/
  dest/
  ├── file1
  ├── file2
  └── file3
  </code></pre>
  
  <p>It's also easy (with globstar) to get only the directories:</p>
  
  <pre><code>$ echo dir/**/*/
  dir/dir/
  </code></pre>
  
  <p>But I don't know how to <strong>glob</strong> only the files, e.g. the following doesn't work:</p>
  
  <pre><code>$ echo dir/**/*!(/)
  dir/**/*!(/)
  </code></pre>