Topic "Help with Download Command"

Author Message
TRBBHM

Guest


I seem to be having trouble downloading a file via command line arguments. It seems to connect fine but when it goes to try to download the file it crashes and I don't know why. I notice in the log file that it's entering passive mode and I do know that my FTP server requires active mode, but I'm not sure where it's getting the command to go passive, nor do I know how to activate active mode.

I've scheduled the following task in Task Scheduler and my command line looks like this:

"C:\Program Files (x86)\WinSCP\WinSCP.exe" /console /log=d:\brombergs\pcfiles\winscplog.txt /command "option batch abort" "option confirm off" "open ftp://<user>:<pw>@<ip>" "get -resume -preservetime -filemask=WEBREG*.XML *"

I want to download any file with the "webreg*.xml" mask into my current working directory.

My log file looks something like this (I've changed the user name, password, and ip address info for security purposes):

. 2013-08-15 17:59:07.391 --------------------------------------------------------------------------
. 2013-08-15 17:59:07.391 WinSCP Version 5.1.7 (Build 3446) (OS 6.0.6002 Service Pack 2)
. 2013-08-15 17:59:07.391 Configuration: HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\
. 2013-08-15 17:59:07.391 Local account: BROMBERGS\autoadmin
. 2013-08-15 17:59:07.391 Working directory: d:\brombergs\pcfiles
. 2013-08-15 17:59:07.391 Process ID: 5072
. 2013-08-15 17:59:07.391 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console /log=d:\brombergs\pcfiles\winscplog.txt /command "option batch abort" "option confirm off" "open ftp://<user>:<pw>@<ip>" "get -resume -preservetime -filemask=WEBREG*.XML *"
. 2013-08-15 17:59:07.391 Time zone: Current: GMT-5, Standard: GMT-6, DST: GMT-5, DST Start: 3/10/2013, DST End: 11/3/2013
. 2013-08-15 17:59:07.391 Login time: Thursday, August 15, 2013 5:59:07 PM
. 2013-08-15 17:59:07.391 --------------------------------------------------------------------------
. 2013-08-15 17:59:07.391 Session name: <user>@<ip> (Modified stored session)
. 2013-08-15 17:59:07.391 Host name: <ip> (Port: 21)
. 2013-08-15 17:59:07.391 User name: <user> (Password: Yes, Key file: No)
. 2013-08-15 17:59:07.391 Tunnel: No
. 2013-08-15 17:59:07.391 Transfer Protocol: FTP
. 2013-08-15 17:59:07.391 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2013-08-15 17:59:07.392 Proxy: none
. 2013-08-15 17:59:07.392 FTP: FTPS: None; Passive: Yes [Force IP: A]; List all: A
. 2013-08-15 17:59:07.392 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2013-08-15 17:59:07.392 Cache directory changes: Yes, Permanent: Yes
. 2013-08-15 17:59:07.392 DST mode: 1; Timezone offset: 0h 0m
. 2013-08-15 17:59:07.392 --------------------------------------------------------------------------
. 2013-08-15 17:59:07.400 Connecting to <ip> ...
. 2013-08-15 17:59:07.921 Connected with <ip>. Waiting for welcome message...
< 2013-08-15 17:59:08.447 220-FileZilla Server version 0.9.41 beta
< 2013-08-15 17:59:08.447 220-written by Tim Kosse (Tim.Kosse@gmx.de)
< 2013-08-15 17:59:08.447 220 Please visit http://sourceforge.net/projects/filezilla/
> 2013-08-15 17:59:08.447 USER <user>
< 2013-08-15 17:59:08.976 331 Password required for <user>
> 2013-08-15 17:59:08.976 PASS *********
< 2013-08-15 17:59:09.508 230 Logged on
> 2013-08-15 17:59:09.508 SYST
< 2013-08-15 17:59:10.036 215 UNIX emulated by FileZilla
> 2013-08-15 17:59:10.036 FEAT
< 2013-08-15 17:59:10.566 211-Features:
< 2013-08-15 17:59:10.566 MDTM
< 2013-08-15 17:59:10.567 REST STREAM
< 2013-08-15 17:59:10.568 SIZE
< 2013-08-15 17:59:10.568 MLST type*;size*;modify*;
< 2013-08-15 17:59:10.568 MLSD
< 2013-08-15 17:59:10.568 UTF8
< 2013-08-15 17:59:10.568 CLNT
< 2013-08-15 17:59:10.568 MFMT
< 2013-08-15 17:59:10.568 211 End
. 2013-08-15 17:59:10.569 Connected
. 2013-08-15 17:59:10.569 --------------------------------------------------------------------------
. 2013-08-15 17:59:10.569 Using FTP protocol.
. 2013-08-15 17:59:10.569 Doing startup conversation with host.
> 2013-08-15 17:59:10.569 PWD
< 2013-08-15 17:59:11.100 257 "/" is current directory.
. 2013-08-15 17:59:11.101 Getting current directory name.
. 2013-08-15 17:59:11.101 Startup conversation with host finished.
< 2013-08-15 17:59:11.101 Script: Active session: [1] <user>@<ip>
> 2013-08-15 17:59:11.101 Script: get -resume -preservetime -filemask=WEBREG*.XML *
. 2013-08-15 17:59:11.101 Retrieving directory listing...
> 2013-08-15 17:59:11.101 TYPE A
< 2013-08-15 17:59:11.634 200 Type set to A
> 2013-08-15 17:59:11.635 PASV
< 2013-08-15 17:59:12.166 227 Entering Passive Mode (<ip>)
> 2013-08-15 17:59:12.166 MLSD
< 2013-08-15 17:59:22.484 425 Can't open data connection.
. 2013-08-15 17:59:22.484 Could not retrieve directory listing
. 2013-08-15 17:59:22.484 Asking user:
. 2013-08-15 17:59:22.484 Error listing directory '/'. ("Could not retrieve directory listing","Can't open data connection.")
< 2013-08-15 17:59:22.484 Script: Error listing directory '/'.
< 2013-08-15 17:59:22.484 Script: Could not retrieve directory listing
< 2013-08-15 17:59:22.484 Can't open data connection.
. 2013-08-15 17:59:22.485 Script: Failed
. 2013-08-15 17:59:22.485 Script: Exit code: 1
. 2013-08-15 17:59:22.486 Disconnected from server
Guest




I now realize that I need to use the -passive=off argument after my open command ("open -passive=off <ip>")

This works, but now it's pulling down sub-directories that I do not want or need. It gets the file(s) that I need, but I do not want the subdirectories. How can I prevent that?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
Try -filemask=WEBREG*.XML|*/

See https://winscp.net/eng/docs/file_mask#directory
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License