title: Recursive find and copy to other directory
body: <p>I need to find all files in a directory and it's subdirectories, but I need to keep directory structure. For example there is a file</p>
  
  <pre><code>/media/subdir1/subdir2/file.jpg
  </code></pre>
  
  <p>and I want to copy it to </p>
  
  <pre><code>/new-media/subdir1/subdir2/file.jpg
  </code></pre>
  
  <p>and the same to all files inside /media/ directory. And by the way, directories inside /new-media/ must be created if not exist.</p>
  
  <p>if I use</p>
  
  <pre><code>find /media/ -name '*.jpg' -exec cp /new-media/ ????? {} \;
  </code></pre>
  
  <p>how can I get all subdirectories inside /media/?</p>