.TH ncftpput 1 NcFTP Software .SH NAME ncftpput - Internet file transfer program for scripts .SH "SYNOPSIS" .PP .B ncftpput .RI [ "options" ] .I "remote-host" "remote-directory" "local-files..." .PP .B ncftpput -f .I "login.cfg" .RI [ "options" ] .I "remote-directory" "local-files..." .PP .B ncftpput -c .I "remote-host" "remote-path-name" < .I "stdin" .\"------- .SH "OPTIONS" .\"------- .SS Command line flags: .TP 8 .BI "-u " "XX" Use username .I XX instead of anonymous. .TP 8 .BI "-p " "XX" Use password .I XX with the username. .TP 8 .BI "-P " "XX" Use port number .I XX instead of the default FTP service port (21). .TP 8 .BI "-j " "XX" Use account .I XX in supplement to the username and password (deprecated). .TP 8 .BI "-d " "XX" Use the file .I XX for debug logging. .TP 8 .B -a Use ASCII transfer type instead of binary. .TP 8 .B -m Attempt to make the remote destination directory before copying. .TP 8 .BI "-t " "XX" Timeout after .I XX seconds. .TP 8 .BI "-U " "XX" Use value .I XX for the umask. .TP 8 .BR "-v" "/" "-V" Do (do not) use progress meters. The default is to use progress meters if the output stream is a TTY. .TP 8 .BI "-f " "XX" Read the file .I XX for host, user, and password information. .TP 8 .B -A Append to remote files, instead of overwriting them. .TP 8 .BI "-T " "XX" Upload into temporary files prefixed by .IR "XX" "." .TP 8 .BI "-S " "XX" Upload into temporary files suffixed by .IR "XX" "." .TP 8 .B -R Recursive mode; copy whole directory trees. .TP 8 .BI "-r " "XX" Redial a maximum of .I XX times until connected to the remote FTP server. .TP 8 .BR "-z" "/" "-Z" Do (do not) try to resume transfers. The default is to .I not try to resume (\-Z). .TP 8 .B -E Use regular (PORT) data connections. .TP 8 .B -F Use passive (PASV) data connections. The default is to use passive, but to fallback to regular if the passive connection fails or times out. .TP 8 .B -DD Delete local file after successfully uploading it. .TP 8 .B -y Try using "SITE UTIME" to preserve timestamps on remote host. Not many remote FTP servers support this, so it may not work. .TP 8 .B -b Run in background (by submitting a batch job and then spawning .IR ncftpbatch ")." .TP 8 .B -bb Similar to .B -b option, but only submits the batch job. You will need to run .I ncftpbatch for the batch job to be processed. This is useful if you already have a .I ncftpbatch process running, or wish to have better control of when batch jobs are processed. .IP For example, if you wanted to do background processing of three files all on the same remote server, it is more polite to use just one .I ncftpbatch process to process the three jobs sequentially, rather than having three .I ncftpbatch processes open three simultaneous FTP sessions to the same server. .TP 8 .BI "-B " "XX" Try setting the TCP/IP socket buffer size to .I XX bytes. .TP 8 .BI "-W " "XX" Send raw FTP command .I XX after logging in. .TP 8 .BI "-X " "XX" Send raw FTP command .I XX after each file transferred. .TP 8 .BI "-Y " "XX" Send raw FTP command .I XX before logging out. .IP The .BR "-W" ", " "-X" ", and " "-Y" options are useful for advanced users who need to tweak behavior on some servers. For example, users accessing mainframes might need to send some special SITE commands to set blocksize and record format information. .IP For these options, you can use them multiple times each if you need to send multiple commands. For the .B "-X" option, you can use the cookie .B %s to expand into the name of the file that was transferred. .\"------- .SH "DESCRIPTION" .\"------- .PP The purpose of .I ncftpput is to do file transfers from the command-line without entering an interactive shell. This lets you write shell scripts or other unattended processes that can do FTP. It is also useful for advanced users who want to send files from the shell command line without entering an interactive FTP program such as .IR ncftp "." .PP By default the program tries to open the remote host and login anonymously, but you can specify a username and password information. The .B -u option is used to specify the username to login as, and the .B -p option is used to specify the password. If you are running the program from the shell, you may omit the .B -p option and the program will prompt you for the password. .PP Using the .B -u and .B -p options are not recommended, because your account information is exposed to anyone who can see your shell script or your process information. For example, someone using the .I ps program could see your password while the program runs. .PP You may use the .B -f option instead to specify a file with the account information. However, this is still not secure because anyone who has read access to the information file can see the account information. Nevertheless, if you choose to use the .B -f option the file should look something like this: .RS .sp host sphygmomanometer.ncftp.com .br user gleason .br pass mypassword .br .sp .RE Don't forget to change the permissions on this file so no one else can read them. .PP The .B -d option is very useful when you are trying to diagnose why a file transfer is failing. It prints out the entire FTP conversation to the file you specify, so you can get an idea of what went wrong. If you specify the special name .I stdout as the name of the debugging output file, the output will instead print to the screen. .PP Using ASCII mode is helpful when the text format of your host differs from that of the remote host. For example, if you are sending a text file from a UNIX system to a Windows-based host, you could use the .B -a flag which would use ASCII transfer mode so that the file created on the Windows machine would be in its native text format instead of the UNIX text format. .PP You can upload an entire directory tree of files by using the .B -R flag. Example: .RS 4 .sp $ ncftpput -R pikachu.nintendo.co.jp /incoming /tmp/stuff .br .sp .RE This would create a /incoming/stuff hierarchy on the remote host. .PP The .B -T and .B -S options are useful when you want to upload file to the remote host, but you don't want to use the destination pathname until the file is complete. Using these options, you will not destroy a remote file by the same name until your file is finished. These options are also useful when a remote process on the remote host polls a specific filename, and you don't want that process to see that file until you know the file is finished sending. Here is an example that uploads to the file /pub/incoming/README, using the filename /pub/incoming/README.tmp as a temporary filename: .RS 4 .sp $ ncftpput -S \.tmp bowser\.nintendo\.co\.jp /pub/incoming /a/README .RE .PP A neat way to pipe the output from any local command into a remote file is to use the .B -c option, which denotes that you're using .I stdin as input. The following example shows how to make a backup and store it on a remote machine: .RS 4 .sp $ tar cf - / | ncftpput -c sonic\.sega\.co\.jp /usr/local/backup.tar .RE .\"------- .SH "DIAGNOSTICS" .\"------- .PP .I ncftpput returns the following exit values: .TP 8 0 Success. .TP 8 1 Could not connect to remote host. .TP 8 2 Could not connect to remote host - timed out. .TP 8 3 Transfer failed. .TP 8 4 Transfer failed - timed out. .TP 8 5 Directory change failed. .TP 8 6 Directory change failed - timed out. .TP 8 7 Malformed URL. .TP 8 8 Usage error. .TP 8 9 Error in login configuration file. .TP 8 10 Library initialization failed. .TP 8 11 Session initialization failed. .\"------- .SH "AUTHOR" .\"------- .PP Mike Gleason, NcFTP Software (http://www.ncftp.com). .\"------- .SH "SEE ALSO" .\"------- .PP .IR ncftpget (1), .IR ncftp (1), .IR ftp (1), .IR rcp (1), .IR tftp (1). .PP .IR "LibNcFTP" " (http://www.ncftp.com/libncftp/)."