What Is examples.ftp.FTPClientExample.java?


What is examples.ftp.FTPClientExample.java?

✍: FYIcenter.com


examples.ftp.FTPClientExample.java is an example program demonstrating how to use the FTPClient class provided in the Apache Commons Net library.

examples.ftp.FTPClientExample.java program connects to an FTP server and retrieves the specified file. If the -s flag is used, it stores the local file at the FTP server. Just so you can see what's happening, all reply strings are printed. If the -b flag is used, a binary transfer is assumed (default is ASCII).

The syntax of running examples.ftp.FTPClientExample.java is given below:

java examples.ftp.FTPClientExample
   [options] <hostname> <username> <password> [<remote file> 
   [<local file>]]

Default behavior is to download a file and use ASCII transfer mode.

-a - use local active mode (default is local passive)
-A - anonymous login (omit username and password parameters)
-b - use binary transfer mode
-c cmd - issue arbitrary command (remote is used as a parameter if provided)
-d - list directory details using MLSD (remote is used as the pathname 
     if provided)
-e - use EPSV with IPv4 (default false)
-E - encoding to use for control channel
-f - issue FEAT command (remote and local files are ignored)
-h - list hidden files (applies to -l and -n only)
-k secs - use keep-alive timer (setControlKeepAliveTimeout)
-l - list files using LIST (remote is used as the pathname if provided)
     Files are listed twice: first in raw mode, then as the formatted 
     parsed data. N.B. if the wrong server-type is used, output may be 
     lost. Use -U or -S as necessary.
-L - use lenient future dates (server dates may be up to 1 day into future)
-m - list file details using MDTM (remote is used as the pathname if provided)
-n - list file names using NLST (remote is used as the pathname if provided)
-p true|false|protocol[,true|false] - use FTPSClient with the specified 
     protocol and/or isImplicit setting
-s - store file on server (upload)
-S - systemType set server system type (e.g. UNIX VMS WINDOWS)
-t - list file details using MLST (remote is used as the pathname if provided)
-U - save unparseable responses
-w msec - wait time for keep-alive reply (setControlKeepAliveReplyTimeout)
-T  all|valid|none - use one of the built-in TrustManager implementations 
     (none = JVM default)
-y format - set default date format string
-Y format - set recent date format string
-Z timezone - set the server timezone for parsing LIST responses
-z timezone - set the timezone for displaying MDTM, LIST, MLSD, MLST responses
-PrH server[:port] - HTTP Proxy host and optional port[80]
-PrU user - HTTP Proxy server username
-PrP password - HTTP Proxy server password
-# - add hash display during transfers


Using commons-net.jar in Java Programs

⇒⇒FAQ for Apache commons-net.jar

2017-05-12, 227👍, 0💬