Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: The get command fails if destination directory does not exist

Yes, the destination directory have to exists. That's it.
You can, of course, use mkdir Windows command from a wrapping batch file, to create the directory, before starting WinSCP script.
alrisk

The get command fails if destination directory does not exist

Hello.

The download via get command fails if destination directory (in my case on Windows) does not exist yet.
If I create destination directory by hand then download works just fine.
How can I make it work?

------------- DownloadWholeDirectoryScript.txt -------------
open sftp://someUser:somePassword;@someHost -hostKey="ssh-rsa 2048 x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:x"

get /foo/bar/* C:\someDirectory\
exit


------------- Console lauched as administrator -------------
cd C:\Program Files (x86)\WinSCP

C:\Program Files (x86)\WinSCP> winscp.com /ini=nul /script=C:\DownloadWholeDirectoryScript.txt
  Searching for host...
  Connecting to host...
  Authenticating...
  Using username "someUser".
  Authenticating with pre-entered password.
  Authenticated.
  Starting the session...
  Session started.
  Active session: [1] someUser@someHost
  Can't create file 'C:\someDirectory\someFile.txt'.
  System Error.  Code: 3.
  The system cannot find the specified path
  (A)bort, (R)etry, (S)kip, Ski(p) all: Abort
C:\Program Files (x86)\WinSCP>
[/b]