Don't create folder if not existing

Advertisement

Azamat
Guest

Don't create folder if not existing

I am using winscp scripting. So, when I upload files to some directory, it uploads even if directory is not existing. I don't want winscp to create a directory on the remote server, when uploading files. Is it possible to change that setting?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Don't create folder if not existing

What protocol are you using? Please post a full log file showing the problem.

To generate log file, enable logging, log in to your server and do the operation and only the operation that causes the error. For posting extensive logs you may use pastebin or similar application. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you may email it to me. You will find my address (if you log in) in my forum profile. Please include link back to this topic in your email. Also note in this topic that you have emailed the log.

Reply with quote

Guest

Re: Don't create folder if not existing

This is not actually a problem. I am using FTP protocol. I just don't want WinSCP to create a folder on a remote server if not existing. Say, this is my script:
start.bat:
winscp /log="log.txt" /script="script.txt"
and script.txt:
option batch on
option confirm off
option reconnecttime 5
option transfer ascii
 
open myFTPserver
 
put "D:\file1.php" "D:\file2.php" "D:\file3.php" ./www/example.com/noSuchFolderOnRemoteServer/
 
close
I am simply uploading 3 files and it is not only uploading, but creating "noSuchFolderOnRemoteServer" folder and uploading those files there. I just don't want WinSCP to create a folder if not existing and maybe show some error like "no such folder" or something like that.

This is just script, but not GUI, you understand I know :)
So, is it possible to turn off automatic folder creating, when not existing?

Diky moc for reply :)

Reply with quote

martin
Site Admin
martin avatar

Re: Don't create folder if not existing

WinSCP just does not create the directory automatically. So please post a log file to let me see what's happening there.

Reply with quote

Azamat
Guest

Re: Don't create folder if not existing

Ok, here you go:
. 2011-07-29 17:02:32.625 --------------------------------------------------------------------------
. 2011-07-29 17:02:32.625 WinSCP Version 4.3.4 (Build 1428) (OS 6.1.7601 Service Pack 1)
. 2011-07-29 17:02:32.628 Configuration: C:\Program Files\WinSCP\WinSCP.ini
. 2011-07-29 17:02:32.630 Login time: Friday, July 29, 2011 5:02:32 PM
. 2011-07-29 17:02:32.630 --------------------------------------------------------------------------
. 2011-07-29 17:02:32.630 Session name: Knock3 (Stored session)
. 2011-07-29 17:02:32.630 Host name: ftp.knock3.com (Port: 21)
. 2011-07-29 17:02:32.630 User name: johndeeray (Password: Yes, Key file: No)
. 2011-07-29 17:02:32.630 Tunnel: No
. 2011-07-29 17:02:32.630 Transfer Protocol: FTP
. 2011-07-29 17:02:32.630 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2011-07-29 17:02:32.630 Proxy: none
. 2011-07-29 17:02:32.630 FTP: FTPS: None; Passive: Yes [Force IP: No]
. 2011-07-29 17:02:32.630 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2011-07-29 17:02:32.630 Cache directory changes: Yes, Permanent: Yes
. 2011-07-29 17:02:32.630 DST mode: 1
. 2011-07-29 17:02:32.630 --------------------------------------------------------------------------
. 2011-07-29 17:02:32.633 Connecting to ftp.knock3.com ...
. 2011-07-29 17:02:33.033 Connected with ftp.knock3.com. Waiting for welcome message...
< 2011-07-29 17:02:33.273 220 ::ffff:172.17.3.9 FTP server ready
> 2011-07-29 17:02:33.273 USER johndeeray
< 2011-07-29 17:02:33.510 331 Password required for johndeeray
> 2011-07-29 17:02:33.510 PASS ********
< 2011-07-29 17:02:33.803 230 User johndeeray logged in
> 2011-07-29 17:02:33.803 SYST
< 2011-07-29 17:02:34.040 215 UNIX Type: L8
> 2011-07-29 17:02:34.040 FEAT
< 2011-07-29 17:02:34.280 211-Features:
< 2011-07-29 17:02:34.280  MDTM
< 2011-07-29 17:02:34.280  REST STREAM
< 2011-07-29 17:02:34.280  SIZE
< 2011-07-29 17:02:34.280 211 End
. 2011-07-29 17:02:34.280 Connected
. 2011-07-29 17:02:34.280 --------------------------------------------------------------------------
. 2011-07-29 17:02:34.280 Using FTP protocol.
. 2011-07-29 17:02:34.295 Doing startup conversation with host.
> 2011-07-29 17:02:34.295 PWD
< 2011-07-29 17:02:34.535 257 "/" is the current directory
. 2011-07-29 17:02:34.535 Getting current directory name.
. 2011-07-29 17:02:34.535 Startup conversation with host finished.
< 2011-07-29 17:02:34.538 Script: Active session: [1] Knock3
> 2011-07-29 17:02:34.538 Script: put "D:\file1.php" "D:\file2.php" "D:\file3.php" ./noSuchFolderOnRemoteServer/
. 2011-07-29 17:02:34.538 Copying 3 files/directories to remote directory "./noSuchFolderOnRemoteServer/"
. 2011-07-29 17:02:34.538   PrTime: No; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 01; Resume: S (102400); CalcS: No; Mask: 
. 2011-07-29 17:02:34.538   TM: A; ClAr: No; CPS: 0; ExclM(No): 
. 2011-07-29 17:02:34.538   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2011-07-29 17:02:34.538 File: "D:\file1.php"
. 2011-07-29 17:02:34.540 Copying "D:\file1.php" to remote directory started.
. 2011-07-29 17:02:34.540 Ascii transfer mode selected.
. 2011-07-29 17:02:34.540 Starting upload of D:\file1.php
> 2011-07-29 17:02:34.540 CWD /noSuchFolderOnRemoteServer/
< 2011-07-29 17:02:34.778 550 /noSuchFolderOnRemoteServer/: No such file or directory
> 2011-07-29 17:02:34.778 CWD /
< 2011-07-29 17:02:35.015 250 CWD command successful
> 2011-07-29 17:02:35.015 MKD noSuchFolderOnRemoteServer
< 2011-07-29 17:02:35.258 257 "/noSuchFolderOnRemoteServer" - Directory successfully created
> 2011-07-29 17:02:35.258 CWD /noSuchFolderOnRemoteServer/
< 2011-07-29 17:02:35.498 250 CWD command successful
> 2011-07-29 17:02:35.498 PWD
< 2011-07-29 17:02:35.735 257 "/noSuchFolderOnRemoteServer" is the current directory
> 2011-07-29 17:02:35.735 TYPE A
< 2011-07-29 17:02:35.975 200 Type set to A
> 2011-07-29 17:02:35.975 PASV
< 2011-07-29 17:02:36.213 227 Entered Passive Mode (72,32,147,147,19,133)
> 2011-07-29 17:02:36.213 LIST
< 2011-07-29 17:02:36.688 150 Opening ASCII mode data connection for file list
< 2011-07-29 17:02:36.690 226 Transfer complete
> 2011-07-29 17:02:36.690 TYPE A
< 2011-07-29 17:02:36.928 200 Type set to A
> 2011-07-29 17:02:36.928 PASV
< 2011-07-29 17:02:37.168 227 Entered Passive Mode (72,32,147,147,74,31)
> 2011-07-29 17:02:37.168 STOR file1.php
< 2011-07-29 17:02:37.645 150 Opening ASCII mode data connection for file1.php
< 2011-07-29 17:02:37.883 226 Transfer complete
. 2011-07-29 17:02:37.885 Upload successful
. 2011-07-29 17:02:37.885 File: "D:\file2.php"
. 2011-07-29 17:02:37.885 Copying "D:\file2.php" to remote directory started.
. 2011-07-29 17:02:37.885 Ascii transfer mode selected.
. 2011-07-29 17:02:37.888 Starting upload of D:\file2.php
> 2011-07-29 17:02:37.888 TYPE A
< 2011-07-29 17:02:38.125 200 Type set to A
> 2011-07-29 17:02:38.125 PASV
< 2011-07-29 17:02:38.363 227 Entered Passive Mode (72,32,147,147,55,91)
> 2011-07-29 17:02:38.365 STOR file2.php
< 2011-07-29 17:02:38.835 150 Opening ASCII mode data connection for file2.php
< 2011-07-29 17:02:39.070 226 Transfer complete
. 2011-07-29 17:02:39.070 Upload successful
. 2011-07-29 17:02:39.070 File: "D:\file3.php"
. 2011-07-29 17:02:39.073 Copying "D:\file3.php" to remote directory started.
. 2011-07-29 17:02:39.073 Ascii transfer mode selected.
. 2011-07-29 17:02:39.073 Starting upload of D:\file3.php
> 2011-07-29 17:02:39.073 TYPE A
< 2011-07-29 17:02:39.310 200 Type set to A
> 2011-07-29 17:02:39.310 PASV
< 2011-07-29 17:02:39.548 227 Entered Passive Mode (72,32,147,147,149,191)
> 2011-07-29 17:02:39.548 STOR file3.php
< 2011-07-29 17:02:40.025 150 Opening ASCII mode data connection for file3.php
< 2011-07-29 17:02:40.265 226 Transfer complete
. 2011-07-29 17:02:40.265 Upload successful
> 2011-07-29 17:02:40.265 Script: close
. 2011-07-29 17:02:40.328 Disconnected from server
It did create folder automatically. Am I doing something wrong? or is it a bug or what?

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: Don't create folder if not existing

OK, you are right. With (and only with) FTP protocol, WinSCP actually creates the destination directory if it does not exist. It is semi-bug.

Reply with quote

Azamat
Guest

Re: Don't create folder if not existing

Can it be fixed in future versions of the program? Because it is important for what I do with WinSCP.

Reply with quote

Advertisement

You can post new topics in this forum