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

martin

Re: Could not retrive directory listing using command scripting.

The script is not using passive mode as you can see in the log. Use the -passive switch with the open command.
https://winscp.net/eng/docs/scriptcommand_open#passive

Edit 2021: The passive mode is the default now.
umbe

Could not retrive directory listing using command scripting.

I'm trying to synch local dirs to remote FTP, and using the GUI version all works fine. But If I try to use the scripting commands, I get the following error (from log):
. 2011-05-05 13:41:53.474 --------------------------------------------------------------------------
. 2011-05-05 13:41:53.475 WinSCP Version 4.2.9 (Build 938) (OS 6.1.7600)
. 2011-05-05 13:41:53.475 Login time: giovedì 5 maggio 2011 13:41:53
. 2011-05-05 13:41:53.475 --------------------------------------------------------------------------
. 2011-05-05 13:41:53.475 Session name: jack@192.168.229.40
. 2011-05-05 13:41:53.476 Host name: 192.168.229.40 (Port: 21)
. 2011-05-05 13:41:53.476 User name: jack (Password: Yes, Key file: No)
. 2011-05-05 13:41:53.476 Tunnel: No
. 2011-05-05 13:41:53.477 Transfer Protocol: FTP
. 2011-05-05 13:41:53.477 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2011-05-05 13:41:53.477 Proxy: none
. 2011-05-05 13:41:53.477 FTP: FTPS: None; Passive: No [Force IP: No]
. 2011-05-05 13:41:53.477 Local directory: default, Remote directory: /jack/BCK-192.168.231.215/test, Update: No, Cache: Yes
. 2011-05-05 13:41:53.477 Cache directory changes: Yes, Permanent: Yes
. 2011-05-05 13:41:53.478 DST mode: 1
. 2011-05-05 13:41:53.478 --------------------------------------------------------------------------
. 2011-05-05 13:41:53.483 Connecting to 192.168.229.40 ...
. 2011-05-05 13:41:53.484 Connected with 192.168.229.40. Waiting for welcome message...
< 2011-05-05 13:41:53.485 220 Microsoft FTP Service
> 2011-05-05 13:41:53.485 USER jack
< 2011-05-05 13:41:53.485 331 Password required for jack.
> 2011-05-05 13:41:53.486 PASS **************
< 2011-05-05 13:41:53.489 230 User logged in.
> 2011-05-05 13:41:53.489 SYST
< 2011-05-05 13:41:53.489 215 Windows_NT
> 2011-05-05 13:41:53.489 FEAT
< 2011-05-05 13:41:53.490 211-Extended features supported:
< 2011-05-05 13:41:53.490  LANG EN*
< 2011-05-05 13:41:53.490  UTF8
< 2011-05-05 13:41:53.490  AUTH TLS;TLS-C;SSL;TLS-P;
< 2011-05-05 13:41:53.490  PBSZ
< 2011-05-05 13:41:53.490  PROT C;P;
< 2011-05-05 13:41:53.490  CCC
< 2011-05-05 13:41:53.491  HOST
< 2011-05-05 13:41:53.491  SIZE
< 2011-05-05 13:41:53.491  MDTM
< 2011-05-05 13:41:53.491  REST STREAM
< 2011-05-05 13:41:53.491 211 END
> 2011-05-05 13:41:53.491 OPTS UTF8 ON
< 2011-05-05 13:41:53.491 200 OPTS UTF8 command successful - UTF8 encoding now ON.
. 2011-05-05 13:41:53.491 Connected
. 2011-05-05 13:41:53.492 Got reply 1 to the command 1
. 2011-05-05 13:41:53.492 --------------------------------------------------------------------------
. 2011-05-05 13:41:53.492 Using FTP protocol.
. 2011-05-05 13:41:53.495 Doing startup conversation with host.
> 2011-05-05 13:41:53.495 PWD
< 2011-05-05 13:41:53.496 257 "/jack" is current directory.
. 2011-05-05 13:41:53.496 Got reply 1 to the command 16
. 2011-05-05 13:41:53.497 Changing directory to "/jack/BCK-192.168.231.215/test".
> 2011-05-05 13:41:53.497 CWD /jack/BCK-192.168.231.215/test
< 2011-05-05 13:41:53.499 250 CWD command successful.
. 2011-05-05 13:41:53.499 Got reply 1 to the command 16
. 2011-05-05 13:41:53.499 Getting current directory name.
> 2011-05-05 13:41:53.499 PWD
< 2011-05-05 13:41:53.500 257 "/jack/BCK-192.168.231.215/test" is current directory.
. 2011-05-05 13:41:53.500 Got reply 1 to the command 16
. 2011-05-05 13:41:53.500 Startup conversation with host finished.
< 2011-05-05 13:41:53.500 Script: Active session: [1] jack@192.168.229.40
. 2011-05-05 13:41:53.501 Session upkeep
> 2011-05-05 13:41:53.501 Script: option transfer binary
< 2011-05-05 13:41:53.501 Script: transfer        binary   
. 2011-05-05 13:41:53.501 Session upkeep
> 2011-05-05 13:41:53.502 Script: option include "*.*"
< 2011-05-05 13:41:53.502 Script: include         *.*       
. 2011-05-05 13:41:53.502 Session upkeep
> 2011-05-05 13:41:53.502 Script: synchronize remote -criteria=size -mirror -delete D:\backup\test"
< 2011-05-05 13:41:53.503 Script: Comparing...
. 2011-05-05 13:41:53.503 Collecting synchronization list for local directory 'D:\backup\test' and remote directory '/jack/BCK-192.168.231.215/test', mode = 0, params = 5635
. 2011-05-05 13:41:53.505 Retrieving directory listing...
> 2011-05-05 13:41:53.505 TYPE A
< 2011-05-05 13:41:53.506 200 Type set to A.
> 2011-05-05 13:41:53.507 PORT 95,110,231,215,195,5
< 2011-05-05 13:41:53.508 200 PORT command successful.
> 2011-05-05 13:41:53.508 LIST -a
< 2011-05-05 13:41:53.510 150 Opening ASCII mode data connection.
. 2011-05-05 13:42:08.684 Timeout detected.
. 2011-05-05 13:42:08.684 Could not retrieve directory listing
. 2011-05-05 13:42:08.684 Got reply 1004 to the command 2

this is my command:
C:\Users\Administrator\Desktop\WinSCPPortable\WinSCPPortable.exe /console /log="C:\Users\Administrator\Desktop\WinSCPPortable\LOG.LOG" /command "option batch on" "option confirm off" "open ftp://jack:!PWD!@192.168.229.40/jack/BCK-192.168.231.215/test" "option transfer binary" "option include ""*.*""" "synchronize remote -criteria=size -mirror -delete "D:\backup\test"" exit

any suggestion?

Using the GUI I'm sure I'm using the PASSIVE mode, I think that also with the scripts is using the passive mode