Gradle SSH plugin copying parent folder and not just files
<p>I'm using <a href="https://gradle-ssh-plugin.github.io/" rel="nofollow">this Gradle SSH plugin</a>. It has a method <code>put</code> that will move files from my local machine to the machine the session is connected to.</p>

<p>My app is fully built and exists in <code>build/app</code> and I'm trying to move it to <code>/opt/nginx/latest/html/</code> such that the file <code>build/app/index.html</code> would exist at <code>/opt/nginx/latest/html/index.html</code> and that any subfolders of <code>build/app</code> are also copied over.</p>

<p>My build.gradle:</p>

<pre><code>buildscript {
  repositories {
    jcenter()
  }
  dependencies {
    classpath 'org.hidetake:gradle-ssh-plugin:1.1.4'
  }
}

apply plugin: 'org.hidetake.ssh'

remotes {
  target {
    host = '&lt;my target vm&gt;'
    user = 'user'
    password = 'pass'
  }
}

...

task deploy() &lt;&lt; {
  ssh.run {
    session(remotes.target) {
      put from: 'build/app/', into: '/opt/nginx/latest/html/'
    }
  }
}
</code></pre>

<p>As I have it above, it's putting all the files into <code>/opt/nginx/latest/html/app</code>. If I change the <code>from</code> to use <code>fileTree(dir: 'build/app')</code> then all the files get copied over but I lose the file structure, i.e. <code>build/app/scripts/main.js</code> gets copied to <code>/opt/nginx/latest/html/main.js</code> instead of the expected <code>/opt/nginx/latest/html/scripts/main.js</code>.</p>

<p>How can I copy the CONTENTS of one directory (not the directory itself) into the target directory while retaining folder structure?</p>