SCP Plugin Throws Exception When Trying to Transfer Multiple Files
Asked by Arif Khan:

I am using Atlasssian Bamboo version 5.0 build 3715 - 11 Jul 13. I tried adding scp task to my build plan in order to transfer some build artifacts to a remote server. When trying to transfer multiple files (by comma separated list or by ant pattern or the whole directory), I encounter this exception:

net.schmizz.sshj.xfer.scp.SCPException: EOF while expecting response to protocol message

However If I add separate scp task for each file, there is no problem.

I tried to transfer the same files using my local scp client and my local scp client can transfer them to the remote with no problem. I tried with different set of files. Only once bamboo scp plugin could send multiple files. Does anybody know whats the problem?


Answers:
author: rsperafico
body: Hello Arif,

Thank you for your question.

I would kindly suggest you the following:

1. please, create a new Plan
2. please, add a Script task as per following:

   ```
   # on Linuxecho "foo" &gt; foo.txtecho "bar" &gt; bar.txtmkdir directoryecho "foo" &gt; directory/foo.txtecho "bar" &gt; directory/bar.txt
   ```

   ```
   # on Windowsecho "foo" &gt; foo.txtecho "bar" &gt; bar.txtmd directoryecho "foo" &gt; directory/foo.txtecho "bar" &gt; directory/bar.txt
   ```

3. please, add a SCP task as per following:

   ```
   Local Path*:foo.txt,bar.txt,directory/foo.txt,directory/bar.txt?Remote Path:/path/to/remote/server?[ ] Use Ant patterns to select files
   ```

4. As a result, you would have the following in the build log and the files copied to the "Remote Path" provided.

   ```
   ...simple	01-Jan-2015 12:50:49	Finished task 'Script'simple	01-Jan-2015 12:50:49	Starting task 'SCP Task' of type 'com.atlassian.bamboo.plugins.bamboo-scp-plugin:scptask'simple	01-Jan-2015 12:50:50	Performing a recursive copy...simple	01-Jan-2015 12:50:50	Uploading 'bar.txt'...simple	01-Jan-2015 12:50:50	Creating remote directory 'directory'...simple	01-Jan-2015 12:50:50	Creating remote directory 'directory'...simple	01-Jan-2015 12:50:50	Uploading 'foo.txt'...simple	01-Jan-2015 12:50:50	Uploading '&lt;bamboo-home&gt;/xml-data/build-dir/PROJ-SCP-JOB1/bar.txt'...simple	01-Jan-2015 12:50:50	'&lt;bamboo-home&gt;/xml-data/build-dir/PROJ-SCP-JOB1/bar.txt' was uploaded successfully.simple	01-Jan-2015 12:50:50	Uploading '&lt;bamboo-home&gt;/xml-data/build-dir/PROJ-SCP-JOB1/directory'...simple	01-Jan-2015 12:50:50	Uploading 'directory/bar.txt'...simple	01-Jan-2015 12:50:50	Uploading 'directory/foo.txt'...simple	01-Jan-2015 12:50:50	'&lt;bamboo-home&gt;/xml-data/build-dir/PROJ-SCP-JOB1/directory' was uploaded successfully.simple	01-Jan-2015 12:50:50	Uploading '&lt;bamboo-home&gt;/xml-data/build-dir/PROJ-SCP-JOB1/foo.txt'...simple	01-Jan-2015 12:50:50	'&lt;bamboo-home&gt;/xml-data/build-dir/PROJ-SCP-JOB1/foo.txt' was uploaded successfully.simple	01-Jan-2015 12:50:50	Finished task 'SCP Task'...
   ```

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

---

Kind regards,  
Rafael P. Sperafico  
Atlassian Support

comments: author: David Mine
body: Is there any way to accomplish this without listing all my files followed by a comma? I would like to copy the folder's contents without having to do that.


author: rsperafico
body: Hello David,In 'Local Path', please use:\*\*/\* (it will copy everything)foo/\* (it will copy everything from 'foo')


author: rsperafico
body: Hello David,Please, be aware of the following <https://jira.atlassian.com/browse/BAM-14439>


author: Arif Khan
body: Thanks