title: How to copy a single file AND it's directory name to another location?
body: <p>How would one copy only a single file from a directory to another location, while maintaining the directory name as well? I've gone through the man page for <code>cp</code> and tried the different parameters like <code>--parent</code> and <code>-R -r</code> but didn't seem to do what I want.</p>
  <p>I have to work on a single file (<code>contigs.txt</code>), and I have 100s of directories that have different names, but all the files within them have the exact same name.</p>
  <p>For example:</p>
  <pre><code>sample_id2300
     |_ file1.txt
     |_ file2.txt
     |_ contigs.txt
  
  
  sample_id3430
     |_ file1.txt
     |_ file2.txt
     |_ contigs.txt
  
  
  sample_id4054
     |_ file1.txt
     |_ file2.txt
     |_ contigs.txt
  </code></pre>
  <p>In order to not accidentally overwrite the <code>contigs.txt</code> file when doing my manipulations on that file for each sample, I'm working on it in a different location so I just want to copy over <code>contigs.txt</code> BUT keep it in the directory that has the idname. So something like:</p>
  <pre><code>sample_id2300
     |_ contigs.txt
  
  
  sample_id3430
     |_ contigs.txt
  
  
  sample_id4054
     |_ contigs.txt
  </code></pre>
  <p>The other thing I tried is the <code>exclude</code> flag in rsync, but then I have to list out all the files I don't want and it still didn't give me the directory name as well.</p>