Windows FTP command-line client
ftp.exe supports an active FTP mode only.
Setting up the FTP in the active mode can be cumbersome nowadays due to firewalls and NATs.
It's likely because of your local firewall or NAT that the server was not able to connect back to your client to establish data transfer connection for the directory listing (
Or your client is not aware of its external IP address and provides an internal address instead to the server (in
PORT command), which the server is obviously not able to use.
See my article Network Configuration for Active Mode.
If possible, you should use a passive mode as it typically requires no additional setup on a client-side.
Unfortunately Windows FTP command-line client (the
ftp.exe) does not support passive mode at all. It makes it pretty useless nowadays.
Use any other Windows FTP command-line client instead. Most other support passive mode.
For example WinSCP defaults to passive mode and there's a guide available for converting Windows FTP script to WinSCP script.
(I'm the author of WinSCP)