### Example NcFTP Spooler Job File Content Source: https://www.ncftp.com/ncftp/doc/ncftpspooler.html A sample job file demonstrating the key-value pair format, comments, and blank lines. This file specifies a 'get' operation with various parameters. ```text # This is a NcFTP spool file entry. job-name=g-20011016-100656-008299-1 op=get hostname=ftp.freebsd.org xtype=I passive=1 remote-dir=pub/FreeBSD local-dir=/tmp remote-file=README.TXT local-file=readme.txt ``` -------------------------------- ### ncftpput Account Information File Example Source: https://www.ncftp.com/ncftp/doc/ncftpput.html Specifies account information in a file for ncftpput. This file should contain the host, username, and password. ```text host sphygmomanometer.ncftp.com user gleason pass mypasswd ``` -------------------------------- ### List Directory Contents (Unix) Source: https://www.ncftp.com/ncftp/doc/ncftp.html Example of how to list directory contents on a Unix system. ```bash /bin/ls -CFrt ``` -------------------------------- ### Get Help for NcFTP Commands Source: https://www.ncftp.com/ncftp/doc/ncftp.html Display a list of all supported commands or get specific help for a particular command by typing 'help' followed by the command name. ```shell help ``` ```shell help open ``` -------------------------------- ### Start NcFTP Background Transfers Source: https://www.ncftp.com/ncftp/doc/ncftp.html The 'bgstart' command initiates any pending background file transfers. This is typically handled automatically by NcFTP upon site closure or program exit, but can be manually triggered. ```bash bgstart ``` -------------------------------- ### Display NcFTP Version with version Source: https://www.ncftp.com/ncftp/doc/ncftp.html The 'version' command displays information about the NcFTP program edition and its installation details. ```bash version ``` -------------------------------- ### Example Job File Name with Process ID and Sequence Number Source: https://www.ncftp.com/ncftp/doc/ncftpspooler.html Illustrates a job file name including a job type, timestamp, process ID, and sequence number. Ensure a dash follows the timestamp if appending extra data. ```text p-20011207-234500-1234-2 ``` -------------------------------- ### Set Anonymous Password Source: https://www.ncftp.com/ncftp/doc/ncftp.html Example of setting the anonymous password configuration variable. ```bash set anon-password ncftp@example.com ``` -------------------------------- ### Specify Redial Count and Delay for Utility Programs Source: https://www.ncftp.com/ncftp/doc/faq.html When using utility programs like ncftpget, use the -r flag to specify both the number of redials and the delay between them. This example attempts 3 redials with a 60-second delay. ```bash ncftpget -r 3,60 ... ``` -------------------------------- ### NcFTP Spooler Post-Shell-Command Example Source: https://www.ncftp.com/ncftp/doc/ncftpspooler.html This Perl script demonstrates how to use the post-shell-command hook to log FTP transfer results. It reads job parameters from standard input and appends a log entry to '/var/log/ncftp_spooler.log' upon successful download or upload. ```perl #!/usr/bin/perl -w use strict; my ($line); my (%params) = (); while (defined($line = )) { $params{$1} = $2 if ($line =~ /^([^=\#\s]+)=(.*)/); } if ((defined($params{"result"})) && ($params{"result"} =~ /^Succeeded/)) { open(LOG, ">> /var/log/ncftp_spooler.log") or exit(1); print LOG "DOWNLOAD" if ($params{"op"} eq "get"); print LOG "UPLOAD" if ($params{"op"} eq "put"); print LOG " ", $params{"local-file"}, "\n"; close(LOG); } ``` -------------------------------- ### Login with Username and Absolute Path (Alternative) Source: https://www.ncftp.com/ncftp/doc/ncftpls.html Demonstrates specifying a username within the URL and using URL encoding for absolute paths. ```bash $ ncftpls ftp://steve@ftp.apple.com/%2Fetc/ ``` -------------------------------- ### Set Redial Delay in NcFTP Shell Source: https://www.ncftp.com/ncftp/doc/faq.html Within the NcFTP shell, use the 'set' command to configure the redial delay. This example sets the delay to 60 seconds. ```bash set redial-delay 60 ``` -------------------------------- ### Display Program Variables with show Source: https://www.ncftp.com/ncftp/doc/ncftp.html Use the 'show' command to display program variables. Specify 'all' to show all variables or a specific variable name. ```bash show ``` ```bash show anon-password ``` -------------------------------- ### Specify Login Credentials in a File Source: https://www.ncftp.com/ncftp/doc/ncftpget.html Use the -f option to specify a file containing host, user, and password information for authentication. Ensure the file has restricted read permissions. ```bash host sphygmomanometer.ncftp.com user gleason pass mypasswd ``` -------------------------------- ### Run Local mkdir Command Source: https://www.ncftp.com/ncftp/doc/ncftp.html Executes the 'mkdir' command on the local host. ```bash lmkdir ``` -------------------------------- ### Create Directory Source: https://www.ncftp.com/ncftp/doc/ncftp.html Command to create a new directory on the remote host. Permissions may restrict its use. ```bash mkdir ``` -------------------------------- ### List Local Directory Contents Source: https://www.ncftp.com/ncftp/doc/ncftp.html Runs 'ls' on the local host and displays the results. Supports standard 'ls' flags. ```bash lcd ~/doclls -lrt p*.txt ``` -------------------------------- ### Save NcFTP Session Settings Source: https://www.ncftp.com/ncftp/doc/ncftp.html Use the 'bookmark' command to save the current session's remote host and directory. This allows for quick resumption of the session later. ```bash bookmark ``` -------------------------------- ### Recursive Directory Upload with ncftpput Source: https://www.ncftp.com/ncftp/doc/ncftpput.html Uploads an entire directory tree recursively to a remote host. Use the -R flag for this functionality. ```bash $ ncftpput -R pikachu.nintendo.co.jp /incoming /tmp/stuff ``` -------------------------------- ### View Local File Page by Page Source: https://www.ncftp.com/ncftp/doc/ncftp.html Displays a local file one page at a time using the configured PAGER program. ```bash lpage ``` -------------------------------- ### One File Per Line Directory Listing Source: https://www.ncftp.com/ncftp/doc/ncftpls.html Use the -1 flag for a simple, one-file-per-line directory listing, which is useful for scripting. ```bash $ ncftpls -1 ftp://ftp.ncftp.com/ncftp/ ``` -------------------------------- ### Login with Username and Absolute Path Source: https://www.ncftp.com/ncftp/doc/ncftpls.html Specify a username and use URL encoding (%2F for '/') to access absolute pathnames on the remote server. ```bash $ ncftpls -u linus ftp://ftp.kernel.org/%2Fusr/src/ ``` -------------------------------- ### Schedule Background File Transfer with NcFTP Source: https://www.ncftp.com/ncftp/doc/ncftp.html Use 'bgget' to schedule a file download to occur at a specific date and time. This allows for non-immediate transfers, useful for managing bandwidth or performing tasks during off-peak hours. ```bash bgget -@ 19971106030000 /pub/idstuff/quake/q2_100.zip ``` -------------------------------- ### Execute Site-Specific Commands with site Source: https://www.ncftp.com/ncftp/doc/ncftp.html The 'site' command allows execution of FTP protocol's site-specific commands. This can be used for operations like changing file permissions. ```bash site chmod 644 README ``` -------------------------------- ### Download File Using URL Source: https://www.ncftp.com/ncftp/doc/ncftpget.html Download a file directly by providing its URL as the sole argument. This is useful for quick downloads from web browsers or newsreaders. ```bash $ cd /tmp $ ncftpget ftp://ftp.ncftp.com/pub/ncftp/ncftp.tar.Z $ zcat ncftp.tar.Z | tar xf - ``` -------------------------------- ### Sample NcFTP Client Trace Log Source: https://www.ncftp.com/ncftp/doc/bug.html A sample trace log file (`$HOME/.ncftp/trace`) generated by the interactive `ncftp` program. This log captures the entire FTP session dialogue and is essential for bug reports. ```log SESSION STARTED at: Wed Aug 27 14:18:41 2003 Program Version: NcFTP 3.1.6/102 Aug 25 2003, 08:04 PM Library Version: LibNcFTP 3.1.6 (August 24, 2003) Process ID: 1174 Platform: linux-x86 Hostname: pc.example.com (rc=3) Terminal: vt100 14:18:41 Fw: firewall.example.com Type: 0 User: joseph Pass: ******** Port: 21 14:18:41 FwExceptions: .example.com,localhost,localdomain 14:18:51 > o ftp.example.com 14:18:51 Resolving ftp.example.com... 14:18:51 Connecting to 172.16.75.25... 14:18:51 LibNcFTP 3.1.6 (August 24, 2003) compiled for linux-x86 14:18:51 Uname: Linux|pc|2.4.20|#2 SMP Mon Feb 17 15:36:45 CST 2003|i686 14:18:51 Glibc: 2.2.4 (stable) 14:18:51 Remote server is running wu-ftpd. 14:18:51 Logging in... 14:18:51 220: ftp.example.com FTP server (Version wu-2.6.1-18) ready. 14:18:51 Connected to 172.16.75.25. 14:18:51 Cmd: USER anonymous 14:18:51 331: Guest login ok, send your complete e-mail address as password. 14:18:51 Cmd: PASS joseph@example.com 14:18:51 Logging in... 14:18:51 230: Guest login ok, access restrictions apply. 14:18:51 Cmd: PWD 14:18:51 257: "/" is current directory. 14:18:51 Logged in to 172.16.75.25 as anonymous. 14:19:31 > get secretfile.txt 14:19:31 Cmd: SIZE secretfile.txt 14:19:31 550: secretfile.txt: No such file or directory. 14:19:31 Cmd: PASV 14:19:31 227: Entering Passive Mode (172,16,75,25,49,39) 14:19:31 Cmd: RETR secretfile.txt 14:19:31 550: secretfile.txt: No such file or directory. 14:19:44 > quit 14:19:46 Cmd: QUIT 14:19:46 221: You have transferred 0 bytes in 0 files. 14:19:46 Total traffic for this session was 1011 bytes in 0 transfers. 14:19:46 Thank you for using the FTP service on ftp.example.com. SESSION ENDED at: Wed Aug 27 14:19:46 2003 ``` -------------------------------- ### Open FTP Connection (Anonymous) Source: https://www.ncftp.com/ncftp/doc/ncftp.html Establishes an FTP control connection to a remote host, logging in anonymously by default. ```bash open ``` -------------------------------- ### Request Specific Remote Server Help Source: https://www.ncftp.com/ncftp/doc/ncftp.html Sends a help request for a specific FTP command to the remote server. ```bash rhelp NLST ``` -------------------------------- ### Upload Directory Tree Source: https://www.ncftp.com/ncftp/doc/ncftp.html Recursively uploads an entire directory and its contents to the remote server using the '-R' flag. ```bash put -R ``` -------------------------------- ### Copy Files Using Wildcard Source: https://www.ncftp.com/ncftp/doc/ncftp.html Copies files matching a wildcard pattern to the remote host, similar to 'mput'. ```bash put *.zip ``` -------------------------------- ### Request Remote Server Help Source: https://www.ncftp.com/ncftp/doc/ncftp.html Sends a help request to the remote server, potentially listing FTP commands or site administrator info. ```bash rhelp ``` -------------------------------- ### Download File from Remote System Source: https://www.ncftp.com/ncftp/doc/ncftp.html Copy a file from the currently connected remote system to your local machine. The program displays transfer progress. ```shell get README.txt ``` -------------------------------- ### Run Local chmod Command Source: https://www.ncftp.com/ncftp/doc/ncftp.html Executes the 'chmod' command on the local host. ```bash lchmod ``` -------------------------------- ### Login with Regular Username Source: https://www.ncftp.com/ncftp/doc/faq.html Use the -u option to log in with a specific username instead of anonymous. This is applicable to all NcFTP programs and the 'open' command in the NcFTP shell. ```bash ncftp -u joeuser ftp.example.com ``` -------------------------------- ### Piping Command Output to Remote File with ncftpput Source: https://www.ncftp.com/ncftp/doc/ncftpput.html Pipes the output of a local command directly into a remote file. Use the -c option to specify stdin as the input source. ```bash $ tar cf - / | ncftpput -c sonic.sega.co.jp /usr/local/backup.tar ``` -------------------------------- ### List NcFTP Bookmarks Source: https://www.ncftp.com/ncftp/doc/ncftp.html The 'bookmarks' command displays the contents of the user's bookmark file, showing saved session configurations. This helps in recalling bookmark names for later use with the 'open' command. ```bash bookmarks ``` -------------------------------- ### Run Local rmdir Command Source: https://www.ncftp.com/ncftp/doc/ncftp.html Executes the 'rmdir' command on the local host. ```bash lrmdir ``` -------------------------------- ### Print Current Local Directory Source: https://www.ncftp.com/ncftp/doc/ncftp.html Prints the current working directory on the local machine. ```bash lpwd ``` -------------------------------- ### List Directory Contents with NcFTP Source: https://www.ncftp.com/ncftp/doc/ncftp.html The 'dir' command displays a detailed listing of files and directories on the remote server, similar to the 'ls -l' command in UNIX. It supports common 'ls' flags for customized output. ```bash dir -rt ``` -------------------------------- ### Run Local mv Command Source: https://www.ncftp.com/ncftp/doc/ncftp.html Executes the 'mv' command (rename) on the local host. ```bash lrename ``` -------------------------------- ### Generating Trace Log with ncftpget Source: https://www.ncftp.com/ncftp/doc/bug.html Use the `-d` option with `ncftpget` to save the FTP protocol trace to a specified log file. This is crucial for debugging issues with non-interactive commands. ```bash ncftpget -d /tmp/ncftpget.log ftp.freebsd.org . /pub/FreeBSD/README.TXT ``` -------------------------------- ### View NcFTP Background Tasks Source: https://www.ncftp.com/ncftp/doc/ncftp.html Displays the list of currently executing NcFTP background tasks by running 'ncftpbatch -l'. ```bash jobs ``` -------------------------------- ### List Directory Contents (Pager) Source: https://www.ncftp.com/ncftp/doc/ncftp.html Commands equivalent to 'dir' and 'ls' that pipe output to a pager, useful for long listings. ```bash pdir, pls ``` -------------------------------- ### List Remote Directory Contents Source: https://www.ncftp.com/ncftp/doc/ncftp.html Prints a directory listing from the remote system, attempting to mimic 'ls -CF'. Supports standard 'ls' flags when the remote server is UNIX-like. ```bash ls ``` ```bash ls -rt ``` -------------------------------- ### Set NcFTP Configuration Variable Source: https://www.ncftp.com/ncftp/doc/ncftp.html Sets a program variable, which is saved in $HOME/.ncftp/prefs. Basic syntax is 'set