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.

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)


Topic review


The root target path must exist.
In the first example, the root is C:\folder1\folder2\
In the second example, the root is C:\folder1\folder2\folder3\folder4\
That's common behavior, most command-line tools behave this way.

Hi Martin,

Why does Winscp create the missing folder structure when wild cards are used, but not when the full path is given. For example this works:

/folder1/folder2/*.* C:\folder1\folder2\

(only C:\folder1\folder2\ exists, but the file /folder1/folder2/folder3/folder4/file1.txt is successfully copied to C:\folder1\folder2\folder3\folder4\file.txt, hence winscp creates folder3\folder4 in order to copy the file.

However, this does not work and gives error: Can't create file
/folder1/folder2/folder3/folder4/file1.txt C:\folder1\folder2\folder3\folder4\file.txt

Re: Create local folder if it does not exist

No, WinSCP won't create target directory. You can create it on your own using mkdir command in the batch file that runs WinSCP (if there any).

Create local folder if it does not exist

I am using WinSCP v4.2.7 build 758 in a batch file to backup my ftp server locally. I also use other variables in the batch file, to put each backup of WinSCP in a different local folder.

My problem is that if the local folder does not exist, WinSCP stops. Is there a way to tell WinSCP to create the local folder if it does not exist?

This is the batch file I use

winscp.exe /log=C:\logs\log.txt /console /command "option batch on" "open" "synchronize local C:\localfolder /home1/username/public_html/remotefolder" "close" "exit"