PSCP wildcard to fixed name

0

I'm trying to copy a file from Windows to Linux, but I don't know the exact filename (it's a war file from a maven project, so I don't know the current version. My example:

pscp -pw <password> "F:\Maven\jenkins\workspace\<project-name>\target\<project-name>-0.0.1-SNAPSHOT.war"  user@192.168.1.132:/var/lib/tomcat8/webapps/ROOT.war

this fails with this error:

pscp: remote filespec /var/lib/tomcat8/webapps/ROOT.war: not a directory

Is there any way to use wildcards, that pscp won't use as a directory?

Thanks

German

Posted 2016-10-13T19:35:19.273

Reputation: 103

Answers

0

Try the below command which worked for me. This is just a syntax and you need to modify the source and destination file path.

pscp.exe -pw passwd -l uname -sftp " source-directory-file-path " x.x.x.x:remote-directory-file-path

manjesh23

Posted 2016-10-13T19:35:19.273

Reputation: 1 404

Hi @manjesh23. It didn't work, I'm getting the same error "not a directory". – German – 2016-10-17T15:13:53.423

Can you please help me with full command you are using? – manjesh23 – 2016-10-17T15:15:24.240

My example is the real one. – German – 2016-10-17T15:17:06.270

pscp -pw <password> "F:\Maven\jenkins\workspace\aaa\target\aaa-0.0.1-SNAPSHOT.war" my-user@192.168.1.132:/var/lib/tomcat8/webapps/ROOT.war – German – 2016-10-17T15:17:39.127

Try this: pscp.exe -pw passwd -l uname -sftp "F:\Maven\jenkins\workspace\aaa\target\aaa-0.0.1-SNAPSHOT.wa‌​r" 192.168.1.132:/var/lib/tomcat8/webapps/ROOT.war – manjesh23 – 2016-10-17T15:19:01.897

Yes, this works fine, but what I'm looking for is to be able to use a wildcar in the source file. pscp.exe -pw passwd -l uname -sftp "F:\Maven\jenkins\workspace\aaa\target\aaa-*.wa‌​‌​r" 192.168.1.132:/var/lib/tomcat8/webapps/ROOT.war – German – 2016-10-17T15:22:29.050

Wildcard will not work because you are specifying source wildcard but destination is a file name. Its just like over-writing the destination file. – manjesh23 – 2016-10-17T15:27:11.020

Let us continue this discussion in chat.

– manjesh23 – 2016-10-17T15:28:22.390