Copy a file via SCP to target but move directory structure upwards?

I need a script for my Java project (on Ubuntu) to deploy the .jar file to a remote windows server using scp.

This is what my script looks like:

scp build/libs/app.jar [email protected]:test/

The app.jar is being copied to the Windows path C:\Users\foo\test. What I need is that the .jar file is copied to the following path: C:\server

I tried the following:

scp build/libs/app.jar [email protected]:..\..\server

But it failed cause the script could not find the directory

I then tried to be absolute

scp build/libs/app.jar [email protected]:c:\server

Same issue. What happens is that scp created some kind of file without file extension called server - omitting the c:\ part. Still that is not really helpful and I am out of ideas how to move up the directory structure for the target option for scp


You have to use a / before the drive letter :

scp /home/ubuntu/myfile username@IP_of_windows_machine:/C:/Users/username/Desktop


Try this

scp build/libs/app.jar [email protected]:/C:/server