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