CD command without parameters doesnt take me to home dir

Advertisement

Bascy
Joined:
Posts:
13

CD command without parameters doesnt take me to home dir

We've been experiencing the following problem for a long time now, and getting to the conclusion that there is something going wrong with the "CD" command without parameters, after a "synchronize".

We are using the following script, which is called with one parameter containing an existing subdir:

option batch on
option confirm off
option transfer bin
option exclude */

open -timeout=120 ftp://yyyyy:xxxxxx@www.zzzzzzz.nl
# Starting in home directory of useraccount, moving to base sync folder
cd htdocs/secret/lccam
# rename sync-folder to avoid simultaneous downloads by users
mv "%1%" "%1%_uploading"
cd "%1%_uploading"
synchronize remote \\sngserver02\SNGProducts\LCCAMQM31\INTL -criteria=both -delete
# moving back to home folder
cd
# moving to base sync folder
cd htdocs/secret/lccam
#undo rename, allowing downloads again
mv "%1%_uploading" "%1%"
close
exit

Every time we run this script and there is nothing to synchronize, it all works well
Every time we run this script and there is something to synchronize, the synchronize goes well, but the "CD" command after the "synchronize" doesn't take me to the home directory but to the directory it was in just before the synchronize command.

We suspect that this is caused by a reconnect that is done when a timeout occurs (and this happens frequently with our ftp-server:-(). It looks like the reconnect changes the home-directory of the session to the directory that was current when the timeout occurred.

See the following log. As you can see at timestamp 2011-01-25 03:52:28.356 the "Changing to Home directory" results in the current directory /usr/local/WWW/A/.5c2/s/sgpartn1/htdocs/secret/lccam/31/beta_uploading

(obscured connection info by hand, clipped out some parts)

Log of Winscp commands
=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=
. 2011-01-25 03:00:01.585 --------------------------------------------------------------------------
. 2011-01-25 03:00:01.585 WinSCP Version 4.2.7 (Build 758) (OS 5.1.2600 Service Pack 3)
. 2011-01-25 03:00:01.585 Login time: dinsdag 25 januari 2011 3:00:01
. 2011-01-25 03:00:01.585 --------------------------------------------------------------------------
. 2011-01-25 03:00:01.585 Session name: yyyyyyy@www.zzzzzz.nl
. 2011-01-25 03:00:01.585 Host name: www.zzzzzzzzzz.nl (Port: 21)
. 2011-01-25 03:00:01.585 User name: yyyyyyyy (Password: Yes, Key file: No)
. 2011-01-25 03:00:01.585 Tunnel: No
. 2011-01-25 03:00:01.585 Transfer Protocol: FTP
. 2011-01-25 03:00:01.585 Ping type: C, Ping interval: 30 sec; Timeout: 120 sec
. 2011-01-25 03:00:01.585 Proxy: none
. 2011-01-25 03:00:01.585 FTP: FTPS: None; Passive: No [Force IP: No]
. 2011-01-25 03:00:01.585 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2011-01-25 03:00:01.585 Cache directory changes: Yes, Permanent: Yes
. 2011-01-25 03:00:01.585 DST mode: 1
. 2011-01-25 03:00:01.585 --------------------------------------------------------------------------
. 2011-01-25 03:00:01.585 Connecting to www.yyyyyyy.nl ...
. 2011-01-25 03:00:01.585 Connected with www.yyyyyyy.nl. Waiting for welcome message...
< 2011-01-25 03:00:02.038 220 XS4ALL ftpd DCLXVI
> 2011-01-25 03:00:02.038 USER xxxxxxx
< 2011-01-25 03:00:02.069 331 Password required for xxxxxxx.
> 2011-01-25 03:00:02.069 PASS ********
< 2011-01-25 03:00:02.131 230 User xxxxxxxx logged in.
> 2011-01-25 03:00:02.131 SYST
< 2011-01-25 03:00:02.163 215 UNIX Type: L8
> 2011-01-25 03:00:02.163 FEAT
< 2011-01-25 03:00:02.194 211-Features:
< 2011-01-25 03:00:02.194 MDTM
< 2011-01-25 03:00:02.194 REST STREAM
< 2011-01-25 03:00:02.194 SIZE
< 2011-01-25 03:00:02.194 211 End
. 2011-01-25 03:00:02.194 Connected
. 2011-01-25 03:00:02.194 --------------------------------------------------------------------------
. 2011-01-25 03:00:02.194 Using FTP protocol.
. 2011-01-25 03:00:02.194 Doing startup conversation with host.
> 2011-01-25 03:00:02.194 PWD
< 2011-01-25 03:00:02.225 257 "/usr/local/WWW/A/.5c2/s/sgpartn1" is current directory.
. 2011-01-25 03:00:02.225 Getting current directory name.
. 2011-01-25 03:00:02.225 Startup conversation with host finished.
. 2011-01-25 03:00:02.225 Cached directory change via "htdocs/secret/lccam" to "/usr/local/WWW/A/.5c2/s/sgpartn1/htdocs/secret/lccam".
. 2011-01-25 03:00:02.225 Getting current directory name.
. 2011-01-25 03:00:02.225 Moving file "31/beta" to "31/beta_uploading".
> 2011-01-25 03:00:02.241 RNFR /usr/local/WWW/A/.5c2/s/sgpartn1/htdocs/secret/lccam/31/beta
< 2011-01-25 03:00:02.303 350 File or directory exists, ready for destination name.
> 2011-01-25 03:00:02.303 RNTO /usr/local/WWW/A/.5c2/s/sgpartn1/htdocs/secret/lccam/31/beta_uploading
< 2011-01-25 03:00:02.350 250 Rename successful
. 2011-01-25 03:00:02.350 Cached directory change via "31/beta_uploading" to "/usr/local/WWW/A/.5c2/s/sgpartn1/htdocs/secret/lccam/31/beta_uploading".
. 2011-01-25 03:00:02.350 Getting current directory name.
. 2011-01-25 03:00:02.350 Collecting synchronization list for local directory '\\sngserver02\SNGProducts\LCCAMQM31\INTL' and remote directory '/usr/local/WWW/A/.5c2/s/sgpartn1/htdocs/secret/lccam/31/beta_uploading', mode = 0, params = 1027
. 2011-01-25 03:00:02.600 Retrieving directory listing...
> 2011-01-25 03:00:02.600 CWD /usr/local/WWW/A/.5c2/s/sgpartn1/htdocs/secret/lccam/31/beta_uploading/
< 2011-01-25 03:00:02.646 250 CWD command successful
> 2011-01-25 03:00:02.646 PWD
< 2011-01-25 03:00:02.678 257 "/usr/local/WWW/A/.5c2/s/sgpartn1/htdocs/secret/lccam/31/beta_uploading" is current directory.
> 2011-01-25 03:00:02.678 TYPE A
< 2011-01-25 03:00:02.709 200 Type set to A
> 2011-01-25 03:00:02.725 PORT 10,53,47,210,5,147
< 2011-01-25 03:00:02.771 200 PORT command successful
> 2011-01-25 03:00:02.771 LIST -a
< 2011-01-25 03:00:02.834 150 Opening ASCII mode data connection for file list
< 2011-01-25 03:00:03.286 226 Transfer complete.
. 2011-01-25 03:00:03.286 Directory listing successful
. 2011-01-25 03:00:03.349 Synchronizing local directory '\\sngserver02\SNGProducts\LCCAMQM31\INTL\' with remote directory '/usr/local/WWW/A/.5c2/s/sgpartn1/htdocs/secret/lccam/31/beta_uploading/', params = 1027
. 2011-01-25 03:00:03.364 Copying 11 files/directories to remote directory "/usr/local/WWW/A/.5c2/s/sgpartn1/htdocs/secret/lccam/31/beta_uploading/"
. 2011-01-25 03:00:03.364 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 01; Resume: S (102400); CalcS: No; Mask: *.*
. 2011-01-25 03:00:03.364 TM: B; ClAr: No; CPS: 0; ExclM(No): */
. 2011-01-25 03:00:03.364 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2011-01-25 03:08:23.988 File: "\\sngserver02\SNGProducts\LCCAMQM31\INTL\Setup_AM31INTL.exe"
. 2011-01-25 03:08:23.988 Copying "\\sngserver02\SNGProducts\LCCAMQM31\INTL\Setup_AM31INTL.exe" to remote directory started.
. 2011-01-25 03:08:23.988 Binary transfer mode selected.
. 2011-01-25 03:08:23.988 Starting upload of \\sngserver02\SNGProducts\LCCAMQM31\INTL\Setup_AM31INTL.exe
> 2011-01-25 03:08:23.988 TYPE I
< 2011-01-25 03:08:24.019 200 Type set to I
> 2011-01-25 03:08:24.019 PORT 10,53,47,210,5,168
< 2011-01-25 03:08:24.066 200 PORT command successful
> 2011-01-25 03:08:24.066 STOR Setup_AM31INTL.exe
< 2011-01-25 03:08:24.160 150 Opening BINARY mode data connection for Setup_AM31INTL.exe
[log file clipped]
. 2011-01-25 03:51:03.402 Timeout detected.
. 2011-01-25 03:51:03.418 Copying files to remote side failed.
. 2011-01-25 03:51:03.434 Connection was lost, asking what to do.
. 2011-01-25 03:51:03.434 Asking user:
. 2011-01-25 03:51:03.434 Lost connection. ("Timeout detected.","Copying files to remote side failed.","Opening BINARY mode data connection for Setup_AM31INTL.exe")
. 2011-01-25 03:51:09.692 Connecting to www.yyyyyyyyyy.nl ...
. 2011-01-25 03:51:09.692 Connected with www.yyyyyyyyy.nl. Waiting for welcome message...
< 2011-01-25 03:51:09.755 220 XS4ALL ftpd DCLXVI
> 2011-01-25 03:51:09.755 USER xxxxxxx
< 2011-01-25 03:51:09.786 331 Password required for xxxxxxx.
> 2011-01-25 03:51:09.786 PASS ********
< 2011-01-25 03:51:09.833 230 User xxxxxxxx logged in.
> 2011-01-25 03:51:09.833 SYST
< 2011-01-25 03:51:09.864 215 UNIX Type: L8
> 2011-01-25 03:51:09.864 FEAT
< 2011-01-25 03:51:09.895 211-Features:
< 2011-01-25 03:51:09.895 MDTM
< 2011-01-25 03:51:09.895 REST STREAM
< 2011-01-25 03:51:09.895 SIZE
< 2011-01-25 03:51:09.895 211 End
. 2011-01-25 03:51:09.895 Connected
. 2011-01-25 03:51:09.895 Doing startup conversation with host.
. 2011-01-25 03:51:09.895 Changing directory to "/usr/local/WWW/A/.5c2/s/sgpartn1/htdocs/secret/lccam/31/beta_uploading".
. 2011-01-25 03:51:09.895 Synchronizing current directory "/usr/local/WWW/A/.5c2/s/sgpartn1/htdocs/secret/lccam/31/beta_uploading".
> 2011-01-25 03:51:09.895 CWD /usr/local/WWW/A/.5c2/s/sgpartn1/htdocs/secret/lccam/31/beta_uploading
< 2011-01-25 03:51:09.942 250 CWD command successful
> 2011-01-25 03:51:09.942 CWD /usr/local/WWW/A/.5c2/s/sgpartn1/htdocs/secret/lccam/31/beta_uploading
< 2011-01-25 03:51:09.973 250 CWD command successful
. 2011-01-25 03:51:09.973 Getting current directory name.
> 2011-01-25 03:51:09.973 PWD
< 2011-01-25 03:51:10.020 257 "/usr/local/WWW/A/.5c2/s/sgpartn1/htdocs/secret/lccam/31/beta_uploading" is current directory.
. 2011-01-25 03:51:10.020 Startup conversation with host finished.
. 2011-01-25 03:51:10.036 File: "\\sngserver02\SNGProducts\LCCAMQM31\INTL\Setup_AM31INTL.exe"
. 2011-01-25 03:51:10.051 Copying "\\sngserver02\SNGProducts\LCCAMQM31\INTL\Setup_AM31INTL.exe" to remote directory started.
. 2011-01-25 03:51:10.051 Binary transfer mode selected.
. 2011-01-25 03:51:10.051 Starting upload of \\sngserver02\SNGProducts\LCCAMQM31\INTL\Setup_AM31INTL.exe
> 2011-01-25 03:51:10.051 TYPE A
< 2011-01-25 03:51:10.098 200 Type set to A
> 2011-01-25 03:51:10.098 PORT 10,53,47,210,5,173
< 2011-01-25 03:51:10.130 200 PORT command successful
> 2011-01-25 03:51:10.130 LIST -a
< 2011-01-25 03:51:10.192 150 Opening ASCII mode data connection for file list
< 2011-01-25 03:51:10.598 226 Transfer complete.
> 2011-01-25 03:51:10.598 TYPE I
< 2011-01-25 03:51:10.629 200 Type set to I
> 2011-01-25 03:51:10.629 PORT 10,53,47,210,5,175
< 2011-01-25 03:51:10.660 200 PORT command successful
> 2011-01-25 03:51:10.660 APPE Setup_AM31INTL.exe
< 2011-01-25 03:51:10.769 150 Opening BINARY mode data connection for Setup_AM31INTL.exe
< 2011-01-25 03:51:10.801 226 Transfer complete.
. 2011-01-25 03:51:10.801 Upload successful
[log file clipped]
. 2011-01-25 03:52:28.356 Changing directory to home directory.
> 2011-01-25 03:52:28.356 CWD /usr/local/WWW/A/.5c2/s/sgpartn1/htdocs/secret/lccam/31/beta_uploading
< 2011-01-25 03:52:28.403 250 CWD command successful
. 2011-01-25 03:52:28.403 Getting current directory name.
. 2011-01-25 03:52:28.403 Changing directory to "htdocs/secret/lccam".
> 2011-01-25 03:52:28.403 CWD htdocs/secret/lccam
< 2011-01-25 03:52:28.434 550 htdocs/secret/lccam: No such file or directory
* 2011-01-25 03:52:28.434 (ECommand) Error changing directory to 'htdocs/secret/lccam'.
* 2011-01-25 03:52:28.434 htdocs/secret/lccam: No such file or directory
. 2011-01-25 03:52:28.434 Moving file "31/beta_uploading" to "31/beta".
> 2011-01-25 03:52:28.434 RNFR /usr/local/WWW/A/.5c2/s/sgpartn1/htdocs/secret/lccam/31/beta_uploading/31/beta_uploading
< 2011-01-25 03:52:28.466 550 /usr/local/WWW/A/.5c2/s/sgpartn1/htdocs/secret/lccam/31/beta_uploading/31/beta_uploading: No such file or directory
. 2011-01-25 03:52:28.466 Asking user:
. 2011-01-25 03:52:28.466 Error moving file '31/beta_uploading' to '31/beta'. ("/usr/local/WWW/A/.5c2/s/sgpartn1/htdocs/secret/lccam/31/beta_uploading/31/beta_uploading: No such file or directory")
. 2011-01-25 03:52:28.466 Disconnected from server
=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=
Last edited by Bascy on 2011-01-27 16:14; edited 1 time in total

Reply with quote

Advertisement

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

Re: CD command without parameters doesnt take me to home dir

cd without path argument does not so anything (or actually it throws an error) as the argument is mandatory.

Reply with quote

Bascy
Joined:
Posts:
13

Re: CD command without parameters doesnt take me to home dir

martin wrote:

cd without path argument does not so anything (or actually it throws an error) as the argument is mandatory.

You are wrong, at least according to the online scripting manual and normal practices on *nix and ftp

https://winscp.net/eng/docs/scriptcommand_cd

Changes remote working directory for active session.
cd [ <directory> ]
If directory is not specified, changes to home directory.
Examples:
cd /home/martin
cd

I don't know where you get the error ... but i don't and you can verify that in the log i posted at the top of this thread. See the log-entry at 2011-01-25 03:52:28.356

Reply with quote

martin
Site Admin
martin avatar

Re: CD command without parameters doesnt take me to home dir

Ok, you are right. Can you post a log file from the latest version?

Reply with quote

Bascy
Joined:
Posts:
13

Re: CD command without parameters doesnt take me to home dir

martin wrote:

Ok, you are right. Can you post a log file from the latest version?

the complete log is in the first post!!

Reply with quote

Advertisement

Bascy
Joined:
Posts:
13

The script has failed with the latest version of WinScp too.
I'v sent the script and the log to your email.

Hope you can fix this

Reply with quote

Advertisement

You can post new topics in this forum