title: How do I copy with scp with a wildcard(*) in the destination path?
body: <p>Is it possible to get the value of what a wildcard matched to? I.e. I want to do</p>
  
  <pre><code>scp -r user@host:some/path/with/*/file.txt cp/to/*/file.txt
  </code></pre>
  
  <p>With the command above, I want</p>
  
  <pre><code>some/path/with/TEST/file.txt --&gt; cp/to/TEST/file.txt
  some/path/with/OTHER/file.txt --&gt; cp/to/OTHER/file.txt
  </code></pre>
  
  <p><strong>EDIT:</strong>
  I'll add some more data of my actual setup, which might make it clearer.</p>
  
  <p>On my server I have the structure</p>
  
  <pre><code>server $ pwd
  ~/sixtrack/simulations
  server $ ls
  run0001
  run0002
  run0003
  ...
  </code></pre>
  
  <p>Each <code>run*</code> is a directory, containing files like <code>run*/summary.dat</code>, <code>run*/tracks.dat</code> etc. I could copy everything over to my own computer like</p>
  
  <pre><code>pingul $ scp -r 'user@host:sixtrack/simulations/*' .
  </code></pre>
  
  <p>However, I would like to not copy over <em>every</em> file, instead just some. Because all files are named the same and only separated through the directory, I have to respect the structure. As such, I would like <code>host:sixtrack/simulations/run0001/summary.dat</code> to go into my local folder <code>/Users/pingul/Workspace/simulations/run0001/summary.dat</code>. </p>
  
  <p>Running</p>
  
  <pre><code>pingul $ pwd
  /Users/pingul/Workspace/simulations
  pingul $ scp -r 'user@host:sixtrack/simulations/*/summary.dat' */.
  </code></pre>
  
  <p>Does not accomplish what I want. Adding the <code>-v</code> option as suggested prints out</p>
  
  <pre><code>Executing: cp -r -- run0001/. run0100/.
  Executing: cp -r -- run0002/. run0100/.
  Executing: cp -r -- run0003/. run0100/.
  ...
  </code></pre>
  
  <p>and I only get one <code>summary.dat</code> in <code>run0100</code>. All other directories are empty (i.e. <code>run0001</code>, <code>run0002</code>, ...)</p>
  
  <p>Is what I want possible?</p>