| 1 |
<HTML> |
| 2 |
<HEAD> |
| 3 |
<TITLE>ncftpls(1) manual page</TITLE> |
| 4 |
</HEAD> |
| 5 |
<BODY bgcolor=white> |
| 6 |
|
| 7 |
<H2>Name</H2> |
| 8 |
<blockquote> |
| 9 |
<b> |
| 10 |
ncftpls</b> - Internet file transfer program for scripts |
| 11 |
</blockquote> |
| 12 |
<H2>Synopsis</H2> |
| 13 |
<blockquote> |
| 14 |
<P> |
| 15 |
<B>ncftpls</B> |
| 16 |
[<I>options</I>]<I></I> <I>ftp://url.style/host/path/name/</I> |
| 17 |
</blockquote> |
| 18 |
|
| 19 |
<center> |
| 20 |
<p> |
| 21 |
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> |
| 22 |
<input type="hidden" name="cmd" value="_s-xclick"> |
| 23 |
<input type="hidden" name="hosted_button_id" value="5JS76LUNSD3HU"> |
| 24 |
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> |
| 25 |
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> |
| 26 |
</form> |
| 27 |
</center> |
| 28 |
|
| 29 |
<H2>Options</H2> |
| 30 |
Command line flags: |
| 31 |
<blockquote> |
| 32 |
<DL> |
| 33 |
|
| 34 |
<DT><B>-m</B></DT> |
| 35 |
<DD>Use a machine readable list format, if the server supports it. |
| 36 |
This requires that the server software support the <TT>MLSD</TT> |
| 37 |
extensions, and many implementations do not support these features.</DD> |
| 38 |
|
| 39 |
<DT><B>-1</B></DT> |
| 40 |
<DD>Most basic format, one item per line. </DD> |
| 41 |
|
| 42 |
<DT><B>-l</B> </DT> |
| 43 |
<DD>Long list format. </DD> |
| 44 |
|
| 45 |
<DT><B>-C</B></DT> |
| 46 |
<DD>Columnized list format. This is the default list format. </DD> |
| 47 |
|
| 48 |
<DT><B>-R</B> </DT> |
| 49 |
<DD>Recurse all subdirectories while listing.</DD> |
| 50 |
|
| 51 |
<DT><B>-a</B> </DT> |
| 52 |
<DD>Show all files, if the server allows it (as in <TT>/bin/ls -a</TT>).</DD> |
| 53 |
|
| 54 |
<DT><B>-i </B><I>XX</I></DT> |
| 55 |
<DD>Filter the listing (if the server supports it) with the wildcard <I>XX</I>.</DD> |
| 56 |
|
| 57 |
<DT><B>-x -</B><I>XX</I></DT> |
| 58 |
<DD>List command flags to use on the remote server.</DD> |
| 59 |
|
| 60 |
<DT><B>-u </B><I>XX</I> </DT> |
| 61 |
<DD>Use username <I>XX</I> instead of anonymous. |
| 62 |
</DD> |
| 63 |
|
| 64 |
<DT><B>-p </B><I>XX</I> </DT> |
| 65 |
<DD>Use password <I>XX</I> with the username. </DD> |
| 66 |
|
| 67 |
<DT><B>-P </B><I>XX</I> </DT> |
| 68 |
<DD>Use port number <I>XX</I> instead |
| 69 |
of the default FTP service port (21). </DD> |
| 70 |
|
| 71 |
<DT><B>-d </B><I>XX</I> </DT> |
| 72 |
<DD>Use the file <I>XX</I> for debug logging. |
| 73 |
</DD> |
| 74 |
|
| 75 |
<DT><B>-t </B><I>XX</I> </DT> |
| 76 |
<DD>Timeout after <I>XX</I> seconds. </DD> |
| 77 |
|
| 78 |
<DT><B>-E</B> </DT> |
| 79 |
<DD>Use regular (PORT) data connections. </DD> |
| 80 |
|
| 81 |
<DT><B>-F</B> </DT> |
| 82 |
<DD>Use passive (PASV) data connections. The default is to use passive, but to fallback to |
| 83 |
regular if the passive connection fails or times out. </DD> |
| 84 |
|
| 85 |
<DT><B>-r </B><I>XX</I> |
| 86 |
</DT> |
| 87 |
<DD>Redial a maximum of <I>XX</I> times until connected to the remote FTP server. |
| 88 |
</DD> |
| 89 |
</DL> |
| 90 |
|
| 91 |
<DT><B>-W </B><I>XX</I> </DT> |
| 92 |
<DD>Send raw FTP command <I>XX</I> after logging in.</DD> |
| 93 |
|
| 94 |
<DT><B>-X </B><I>XX</I> </DT> |
| 95 |
<DD>Send raw FTP command <I>XX</I> after each file transferred.</DD> |
| 96 |
|
| 97 |
<DT><B>-Y </B><I>XX</I> </DT> |
| 98 |
<DD> |
| 99 |
Send raw FTP command <I>XX</I> before logging out. |
| 100 |
<P> |
| 101 |
The <B>-W</B>, <B>-X</B>, and <B>-Y</B> options are useful for advanced |
| 102 |
users who need to tweak behavior on some servers. |
| 103 |
For example, users accessing mainframes might need |
| 104 |
to send some special SITE commands to set blocksize |
| 105 |
and record format information. |
| 106 |
<P> |
| 107 |
For these options, you can use them multiple times |
| 108 |
each if you need to send multiple commands. |
| 109 |
For the |
| 110 |
<B>-X</B> option, you can use the cookie <TT>%s</TT> to expand |
| 111 |
into the name of the file that was transferred. |
| 112 |
</DD> |
| 113 |
|
| 114 |
<DT><B>-o </B><I>XX</I> </DT> |
| 115 |
<DD>Set advanced option <I>XX</I>. |
| 116 |
<P> |
| 117 |
This option is used primarily for debugging. |
| 118 |
It sets the value of an internal variable to an integer value. |
| 119 |
An example usage would be: |
| 120 |
<tt>-o useFEAT=0,useCLNT=1</tt> |
| 121 |
which in this case, disables use of the |
| 122 |
FEAT command and enables use of the CLNT command. |
| 123 |
The available variables include: |
| 124 |
<tt>usePASV</tt>, |
| 125 |
<tt>useSIZE</tt>, |
| 126 |
<tt>useMDTM</tt>, |
| 127 |
<tt>useREST</tt>, |
| 128 |
<tt>useNLST_a</tt>, |
| 129 |
<tt>useNLST_d</tt>, |
| 130 |
<tt>useFEAT</tt>, |
| 131 |
<tt>useMLSD</tt>, |
| 132 |
<tt>useMLST</tt>, |
| 133 |
<tt>useCLNT</tt>, |
| 134 |
<tt>useHELP_SITE</tt>, |
| 135 |
<tt>useSITE_UTIME</tt>, |
| 136 |
<tt>STATfileParamWorks</tt>, |
| 137 |
<tt>NLSTfileParamWorks</tt>, |
| 138 |
<tt>require20</tt>, |
| 139 |
<tt>allowProxyForPORT</tt>, |
| 140 |
<tt>doNotGetStartCWD</tt>. |
| 141 |
</DD> |
| 142 |
|
| 143 |
</blockquote> |
| 144 |
|
| 145 |
<H2>Description</H2> |
| 146 |
<P> |
| 147 |
The purpose of <I>ncftpls</I> is to do remote directory listings |
| 148 |
using the File Transfer Protocol without entering an interactive shell. |
| 149 |
This lets you write shell scripts or other unattended processes that can |
| 150 |
do FTP. <P> |
| 151 |
The default behavior is to print the directory listing in columnized |
| 152 |
format (i.e. ls -CF), but that is not very useful for scripting. This example |
| 153 |
uses the <B>-1</B> flag, to print one file per line: <blockquote> |
| 154 |
<pre>$ ncftpls -1 ftp://ftp.ncftp.com/ncftp/</pre> |
| 155 |
</blockquote> |
| 156 |
|
| 157 |
<P>Better yet, try the machine readable format: |
| 158 |
<blockquote> |
| 159 |
<pre>$ ncftpls -m ftp://ftp.ncftp.com/ncftp/ |
| 160 |
type=cdir;modify=20050407005654;UNIX.mode=0755 /ncftp |
| 161 |
type=pdir;modify=20010521005346;UNIX.mode=0755 / |
| 162 |
type=dir;modify=20050512221217;UNIX.mode=0755 binaries |
| 163 |
type=file;size=95832;modify=19971122045900;UNIX.mode=0644 ncftp-1.9.5.tar.gz |
| 164 |
type=file;size=192937;modify=19980320033600;UNIX.mode=0644 ncftp-2.4.3.tar.gz |
| 165 |
type=file;size=409722;modify=20050325011837;UNIX.mode=0644 ncftp-3.1.9-src.tar.bz2 |
| 166 |
type=file;size=516060;modify=20050325011837;UNIX.mode=0644 ncftp-3.1.9-src.tar.gz |
| 167 |
type=file;size=655834;modify=20050325011837;UNIX.mode=0644 ncftp-3.1.9-src.zip</pre> |
| 168 |
</blockquote> |
| 169 |
<P>Regrettably, many servers won't work with the machine redable option, |
| 170 |
since they don't support the required FTP server software extensions (MLSD) |
| 171 |
that make this possible. |
| 172 |
Also beware that the fields shown may vary, as well as the order. |
| 173 |
See the official machine readable list format <a href="http://www.ncftp.com/ncftp/doc/draft-ietf-ftpext-mlst-16.txt">documentation</a> for details. |
| 174 |
|
| 175 |
<P> |
| 176 |
You can also do a remote "ls -l", |
| 177 |
by using <tt>ncftpls -l</tt>. If you want to try other flags (but be careful, the remote server may not support them), you have to use them |
| 178 |
with the <B>-x</B> flag. For example, if you wanted to do a remote "ls -lrt", you |
| 179 |
could do this: |
| 180 |
<blockquote> |
| 181 |
<pre>$ ncftpls -x "-lrt" ftp://ftp.ncftp.com/ncftp/</pre> |
| 182 |
</blockquote> |
| 183 |
|
| 184 |
<P>If you wanted to filter the listing, say, to show just files that ended |
| 185 |
in the extension <TT>.TXT</TT>, you could try the <B>-i</B> flag, like this: |
| 186 |
<blockquote> |
| 187 |
<pre>$ ncftpls -1 -i '*.TXT' ftp://ftp.freebsd.org/pub/FreeBSD/</pre> |
| 188 |
</blockquote> |
| 189 |
|
| 190 |
<P>Filtering may not work, since it depends on the FTP server software |
| 191 |
implementation. Here's a better way which does not depend on the server: |
| 192 |
<blockquote> |
| 193 |
<pre>$ ncftpls -1 ftp://ftp.freebsd.org/pub/FreeBSD/ | grep -i '\.TXT$' </pre> |
| 194 |
</blockquote> |
| 195 |
|
| 196 |
<P> |
| 197 |
By default the program tries |
| 198 |
to open the remote host and login anonymously, but you can specify a username |
| 199 |
and password information like you can with <I>ncftpget</I> or <I>ncftpput</I>. |
| 200 |
|
| 201 |
<P> |
| 202 |
Note that the standard specifies that URL pathnames are are relative pathnames. |
| 203 |
For FTP, this means that URLs specify relative pathnames from the start |
| 204 |
directory, which for user logins, are typically the user's home directory. |
| 205 |
If you want to use absolute pathnames, you need to include a literal slash, |
| 206 |
using the "%2F" code for a "/" character. Examples: <blockquote> |
| 207 |
<pre>$ ncftpls -u linus ftp://ftp.kernel.org/%2Fusr/src/ |
| 208 |
$ ncftpls ftp://[email protected]/%2Fetc/</pre> |
| 209 |
</blockquote> |
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
<H2>Diagnostics</H2> |
| 215 |
|
| 216 |
<blockquote> |
| 217 |
|
| 218 |
<P> |
| 219 |
<I>ncftpls</I> returns the following exit values: |
| 220 |
<OL start="0"> |
| 221 |
<LI>Success. </LI><LI>Could not connect to |
| 222 |
remote host. </LI><LI>Could not connect to remote host - timed out. </LI><LI>Transfer failed. |
| 223 |
</LI><LI>Transfer failed - timed out. </LI><LI>Directory change failed. </LI><LI>Directory change failed |
| 224 |
- timed out. </LI><LI>Malformed URL. </LI><LI>Usage error. </LI><LI>Error in login configuration file. |
| 225 |
</LI><LI>Library initialization failed. </LI><LI>Session initialization failed. </LI> |
| 226 |
</OL> |
| 227 |
|
| 228 |
</blockquote> |
| 229 |
|
| 230 |
<H2>Author</H2> |
| 231 |
<blockquote> |
| 232 |
<P> |
| 233 |
Mike Gleason, <a href="http://www.ncftp.com">NcFTP Software</a>. |
| 234 |
</blockquote> |
| 235 |
<H2>See Also</H2> |
| 236 |
<blockquote> |
| 237 |
<P> |
| 238 |
<I><I>ncftpput</I>(1)</I>, <I><I>ncftpget(1)</I>,</I> |
| 239 |
<I><I>ncftp</I>(1)</I>, <I><I>ftp</I>(1)</I>, <I><I>rcp</I>(1)</I>, <I><I>tftp</I>(1)</I>. <P> |
| 240 |
<I>LibNcFTP</I> (<a href="http://www.ncftp.com/libncftp/">http://www.ncftp.com/libncftp/</a>). |
| 241 |
</blockquote> |
| 242 |
</BODY></HTML> |