1ncftpget(1) General Commands Manual ncftpget(1)
2
3
4
6 ncftpget - Internet file transfer program for scripts
7
9 ncftpget [options] remote-host local-directory remote-files...
10
11 ncftpget [options] bookmark-name local-directory remote-files...
12
13 ncftpget -f login.cfg [options] local-directory remote-files...
14
15 ncftpget [options] ftp://url.style.host/path/name
16
17 ncftpget -c [options] remote-host remote-file > stdout
18
19 ncftpget -C [options] remote-host remote-file local-path-name
20
21 ncftpget -c [options] ftp://url.style.host/path/name > stdout
22
24 Command line flags:
25 -u XX Use username XX instead of anonymous.
26
27 -p XX Use password XX with the username.
28
29 -P XX Use port number XX instead of the default FTP service port
30 (21).
31
32 -j XX Use account XX in supplement to the username and password (dep‐
33 recated).
34
35 -d XX Use the file XX for debug logging.
36
37 -a Use ASCII transfer type instead of binary.
38
39 -t XX Timeout after XX seconds.
40
41 -v/-V Do (do not) use progress meters. The default is to use
42 progress meters if the output stream is a TTY.
43
44 -f XX Read the file XX for host, user, and password information.
45
46 -c Read from remote host and write locally to standard out.
47
48 -C Read from remote host and write locally to specified pathname.
49
50 -A Append to local files, instead of overwriting them.
51
52 -z/-Z Do (do not) try to resume transfers. The default is to try to
53 resume (-z).
54
55 -E Use regular (PORT) data connections.
56
57 -F Use passive (PASV) data connections. The default is to use
58 passive, but to fallback to regular if the passive connection
59 fails or times out.
60
61 -DD Delete remote file after successfully downloading it.
62
63 -R Recursive mode; copy whole directory trees.
64
65 -T Do not use automatic on-the-fly TAR mode for downloading whole
66 directory trees. ncftpget uses TAR whenever possible since
67 this usually preserves symbolic links and file permissions.
68 TAR mode can also result in faster transfers for directories
69 containing many small files, since a single data connection can
70 be used rather than an FTP data connection for each small file.
71 The downside to using TAR is that it forces downloading of the
72 whole directory, even if you had previously downloaded a por‐
73 tion of it earlier, so you may want to use this option if you
74 want to resume downloading of a directory.
75
76 -r XX Redial a maximum of XX times until connected to the remote FTP
77 server.
78
79 -b Run in background (by submitting a batch job and then spawning
80 ncftpbatch).
81
82 -bb Similar to -b option, but only submits the batch job. You will
83 need to run ncftpbatch for the batch job to be processed. This
84 is useful if you already have a ncftpbatch process running, or
85 wish to have better control of when batch jobs are processed.
86
87 For example, if you wanted to do background processing of three
88 files all on the same remote server, it is more polite to use
89 just one ncftpbatch process to process the three jobs sequen‐
90 tially, rather than having three ncftpbatch processes open
91 three simultaneous FTP sessions to the same server.
92
93 -B XX Try setting the TCP/IP socket buffer size to XX bytes.
94
95 -W XX Send raw FTP command XX after logging in.
96
97 -X XX Send raw FTP command XX after each file transferred.
98
99 -Y XX Send raw FTP command XX before logging out.
100
101 The -W, -X, and -Y options are useful for advanced users who
102 need to tweak behavior on some servers. For example, users
103 accessing mainframes might need to send some special SITE com‐
104 mands to set blocksize and record format information.
105
106 For these options, you can use them multiple times each if you
107 need to send multiple commands. For the -X option, you can use
108 the cookie %s to expand into the name of the file that was
109 transferred.
110
111 -o XX Set advanced option XX.
112
113 This option is used primarily for debugging. It sets the value
114 of an internal variable to an integer value. An example usage
115 would be: -o useFEAT=0,useCLNT=1 which in this case, disables
116 use of the FEAT command and enables the CLNT command. The
117 available variables include: usePASV, useSIZE, useMDTM, useR‐
118 EST, useNLST_a, useNLST_d, useFEAT, useMLSD, useMLST, useCLNT,
119 useHELP_SITE, useSITE_UTIME, STATfileParamWorks, NLSTfileParam‐
120 Works, require20, allowProxyForPORT, doNotGetStartCWD.
121
123 The purpose of ncftpget is to do file transfers from the command-line
124 without entering an interactive shell. This lets you write shell
125 scripts or other unattended processes that can do FTP. It is also use‐
126 ful for advanced users who want to retrieve files from the shell com‐
127 mand line without entering an interactive FTP program such as ncftp.
128
129 One particularly useful feature of this program is that you can give it
130 a uniform resource locator as the only argument and the program will
131 download that file. You can then copy and paste from your web browser
132 or newsreader and use that URL. Example:
133
134 $ cd /tmp
135 $ ncftpget ftp://ftp.ncftp.com/pub/ncftp/ncftp.tar.Z
136 $ zcat ncftp.tar.Z | tar xf -
137
138 By default the program tries to open the remote host and login anony‐
139 mously, but you can specify a username and password information. The
140 -u option is used to specify the username to login as, and the -p
141 option is used to specify the password. If you are running the program
142 from the shell, you may omit the -p option and the program will prompt
143 you for the password.
144
145 Using the -u and -p options are not recommended, because your account
146 information is exposed to anyone who can see your shell script or your
147 process information. For example, someone using the ps program could
148 see your password while the program runs.
149
150 You may use the -f option instead to specify a file with the account
151 information. However, this is still not secure because anyone who has
152 read access to the information file can see the account information.
153 Nevertheless, if you choose to use the -f option the file should look
154 something like this:
155
156 host sphygmomanometer.ncftp.com
157 user gleason
158 pass mypasswd
159
160 Don't forget to change the permissions on this file so no one else can
161 read them.
162
163 The -d option is very useful when you are trying to diagnose why a file
164 transfer is failing. It prints out the entire FTP conversation to the
165 file you specify, so you can get an idea of what went wrong. If you
166 specify the special name stdout as the name of the debugging output
167 file, the output will instead print to the screen. Example:
168
169 $ ncftpget -d stdout bowser.nintendo.co.jp . /pub/README
170 220: FTP server ready.
171 Connected to bowser.nintendo.co.jp.
172 Cmd: USER anonymous
173 331: Guest login ok, send your complete e-mail address as password.
174 Cmd: PASS xxxxxxxx
175 230: Welcome!
176 Logged in to bowser.nintendo.co.jp as anonymous.
177 Cmd: TYPE I
178 200: Type set to I.
179 Cmd: PORT 192,168,9,37,6,76
180 200: PORT command successful.
181 Cmd: RETR /pub/README
182 550: /pub/README: File in use.
183 Cmd: QUIT
184 221: Goodbye.
185
186 Using ASCII mode is helpful when the text format of your host differs
187 from that of the remote host. For example, if you are retrieving a
188 .TXT file from a Windows-based host to a UNIX system, you could use the
189 -a flag which would use ASCII transfer mode so that the file created on
190 the UNIX system would be in the UNIX text format instead of the MS-DOS
191 text format.
192
193 You can retrieve an entire directory tree of files by using the -R
194 flag. However, this will work only if the remote FTP server is a UNIX
195 server, or emulates UNIX's list output. Example:
196
197 $ ncftpget -R ftp.ncftp.com /tmp /pub/ncftp
198
199 This would create a /tmp/ncftp hierarchy.
200
202 ncftpget returns the following exit values:
203
204 0 Success.
205
206 1 Could not connect to remote host.
207
208 2 Could not connect to remote host - timed out.
209
210 3 Transfer failed.
211
212 4 Transfer failed - timed out.
213
214 5 Directory change failed.
215
216 6 Directory change failed - timed out.
217
218 7 Malformed URL.
219
220 8 Usage error.
221
222 9 Error in login configuration file.
223
224 10 Library initialization failed.
225
226 11 Session initialization failed.
227
229 Mike Gleason, NcFTP Software (http://www.ncftp.com).
230
232 ncftpput(1), ncftp(1), ftp(1), rcp(1), tftp(1).
233
234 LibNcFTP (http://www.ncftp.com/libncftp/).
235
236
237
238ncftpget NcFTP Software ncftpget(1)