Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

unabletostay

Thank you kindly :)
martin

Re: I need SFTP to create remote directories via command line

option batch continue

mkdir /%computername%/Data
option batch abort


But you still get an error exit code and error record in the log.

Clean solution would be to use Session.FileExists from WinSCP .NET assembly:
https://winscp.net/eng/docs/library_session_fileexists
unabletostay

I need SFTP to create remote directories via command line

Hi,

I'm using 5.1.3.0 via command line on a growing number of servers to backup a specific location. I'm using a Windows environmental variable %computername% so minimise customisation of the script per server.

I'm finding that when attempting to transfer to /%computername%/Data that because the /%computername% doesn't exist it fails. This makes sense and from my understanding this is by design. Is there however any switches I can use to change this so it does create the directory?

Script below:

winscp.com /log=log.txt /script=backupScript.txt


backupScript.txt


option batch abort
option confirm off
open username:password@server
synchronize remote -delete "E:\Data" "/%computername%/Data"
exit


Thanks in advance for your help. :)