title: scp a folder to a remote system keeping the directory layout
body: <p>I have a large directory tree with hundreds of nested sub-folders. I need to copy only 4 folders and their contents to a remote system, but I need to destination folder structure to be kept the same.</p>
  
  <p>E.G.</p>
  
  <pre><code>./test/sub1/subsub1/hello.txt
  ./test/sub1/subsub2/hello2.txt    
  ./test/sub2/hello3.txt
  </code></pre>
  
  <p>I want to copy ./test/sub1/subsub1/* to a target such as user@system:~/test/sub1/subsub1/* but I do not want to copy subsub2 or sub2.</p>
  
  <p>I have tried using scp as follows:</p>
  
  <pre><code>scp -r ./test/sub1/subsub1 me@my-system:~/test/sub1/subsub1
  </code></pre>
  
  <p>The result: scp: /test/sub1/subsub1: No such file or directory</p>
  
  <p>I also tried:</p>
  
  <pre><code>scp -r ./test/sub1/subsub1 me@my-system:~/test
  </code></pre>
  
  <p>This works, but dumps all the files into a single directory. The /test/sub1/subsub1 directory structure is not maintained.</p>
  
  <p>How can I copy a folder, whilst maintaining its structure?</p>