0

When trying to upload a file to FTP I always fail. Using following configuration:

#connect ftp
open ftpes://...

#copy  file
put .\\..\\Java\\WebApp\\target\\PROD-*.zip /project/produktion/

#clean exit
exit

But when I use following configuration it works:

#connect ftp
open ftpes://...

#copy  file
put C:\\svn\\project\\branch\\Java\\WebApp\\target\\PROD-*.zip /project/produktion/

#clean exit
exit

Know one could say just switch to GIT and you will have less problems. Nice try but that's something I can't control.

Now I already had a look at WinSCP web site but I could not find any answer.

How can I use relative path to upload the file? Is it possible to use relative paths? Is there any workaround?

Update / Additional information:

My current project structure on SVN looks kind of this:

Project
 |    
 +-- java
 |  |  
 |  +-- myproject
 |    
 +-- script
 |  |  
 |  +-- deploy.cmd
 |  +-- winscp.script
 |    
 +-- tools
 |  |  
 +  |-- winscp

I am not happy with it because now WinSCP will be included in each branch. But it seems to be the only way to enable deploy.cmd script to run properly using WinSCP.

My deploy.cmd look kind of this

@echo on
set pathX=.\..

@echo svn update
svn update %pathX%

@echo mvn build PL
call mvn -f %pathX%\Java clean install

@echo uploading FTP
.\..\tools\winscp\winscp.com /ini=nul /script=winscp.script

@pause

And my winscp.script like this

#connect ftp
open ftpes://......

#upload file
put .\\..\\..\\Java\\myproject\\target\\*.zip /myproject/

#clean exit
exit

But still it can not find the file.

1

You can use relative paths in WinSCP.

If it does not work, then the working directory is different than you think.

Initial working directory depends on how you start WinSCP. You didn't tell us anything about that. So I cannot be more specific.

WinSCP logs its working directory at the beginning of its log file:

. 2020-03-12 13:13:49.814 --------------------------------------------------------------------------
. 2020-03-12 13:13:49.823 WinSCP Version 5.17.2 (Build 10278) (OS 10.0.18363 - Windows 10 Enterprise)
. 2020-03-12 13:13:49.823 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2020-03-12 13:13:49.824 Log level: Normal
. 2020-03-12 13:13:49.824 Local account: DOMAIN\user
. 2020-03-12 13:13:49.824 Working directory: C:\Users\user\Documents
...
  • Thx! I have added additional information to my question. How do you enable this debug output? I've tried your advice and used relative path but it still does not work. – kleenxcoder Mar 13 '20 at 20:20
  • OK sometime you just need someone to talk to. I realized that your hint was great and I just failed because I haven't realized that WinsSCP ist casse sensitive when it comes to directories. Btw my current directory is the directory inside script folder! – kleenxcoder Mar 13 '20 at 20:29
  • "WinsSCP ist casse sensitive when it comes to directories" – WinSCP does not really care for most purposes. But you probably connect to Linux server. And Linux is case sensitive (not only for directories). – Martin Prikryl Mar 14 '20 at 17:16
  • Hmmm strange! My local developer machine is running Win10. The remote FTP is (as usual) running UNIX. But when you look at my description I was failing on my local machine where I have a difference on the first character in "Java" folder. So I was running into a problem on my local machine. After fixing this everything is fine. – kleenxcoder Mar 17 '20 at 10:06
  • That seems unlikely to me. If you want us to check, please post logs from both scenarios. – Martin Prikryl Mar 17 '20 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.