FTP_NEW, Utilities, Tracks an FTP Site for File Changes FTP_NEW is a command procedure to check an ftp directory or tree for new, changed, or removed files. The procedure gets a listing of the directory using DIR/FTP/FULL, parses the output, and stores the file information in an indexed file. The latest file information is compared to that stored to identify new, changed, or removed files. The procedure can optionally call an action routine to process a new or changed file based on a simple text filter. Usage: $ @FTP_NEW CONFIGURATION_FILE Parameters are passed using a configuration file. A configuration record consists of a key and a value separated by whitespace (spaces or tabs). NODE ftp_server FTP server to contact [TYPE] UNIX|VMS FTP server type [DIR] directory_name Directory name to explore [FILE] file_name File name mask to match [USER] ftp_username FTP server username [PASS] ftp_password FTP server password [RECURSE] TRUE|FALSE Explore sub-directories (default FALSE) [DATES] TRUE|FALSE Compare dates (default FALSE) [CASE] TRUE|FALSE Action filters are case sensitive [LIMIT] INTEGER Limit the number of action events [ACTION] filter routine [param] See notes below Configuration using only tabs as separators can be enabled by defining the logical FTP_NEW_STRICT_CONFIG to "1", this allows for spaces to be included in values (e.g. directory_name). The default configuration file extension is .CFG .The procedure creates a data file and a history file. The files are created using the name and location of the configuration file with extensions of .DAT and .HISTORY respectively. Directory trees can be processed using the RECURSE option in which case the procedure calls itself to process subdirectories. By default the procedure compares only size information to identify changes. The logical FTP_NEW_DEBUG can be defined to increase the level of logging, e.g. $define FTP_NEW_DEBUG 1 Actions ------- An action can be called for a new, changed, or removed file. The format of an action configuration entry is (tokens separated by whitespace) ACTION filter routine [param] filter - text appears in filename (e.g. *.txt) or * to match all routine - FTP_NEW routine to call param - parameter to pass to routine Actions are evaluated in the order they appear in the configuration file, the first matching action is executed. The filter text string is compared with the file name only, i.e. not the directory portion, and excluding the VMS file version. Partial wildcards are supported using the * wildcard operator (.e.g. *.txt). Action routines are: MAIL - mail the file to PARAM NOTIFY - mail notification of file to PARAM NULL - mark the file as actioned COPY - copy file to directory PARAM using default transfer mode COPY_ASCII - copy file to directory PARAM using text/ascii mode COPY_BINARY - copy file to directory PARAM using binary mode DCL - call DCL command procedure PARAM, the procedure is called with P1 remote node, P2 remote directory, P3 remote filename, P4 reflects the state change - "NEW", "CHANGED", or "REMOVED" DCL_ASCII - call DCL command procedure PARAM after copying the file in text/ascii mode to a temporary file. Parameters P1 to P4 are as DCL, P5 is the name of the temporary file. DCL_BINARY - like DCL_ASCII but with a binary mode copy. The datafile records the last successful date an action was processed for each file, and will retry failed actions on subsequent runs if required. DCL action procedures should return a meaningful status value, an action is treated as failed if it returns a severity other than SUCCESS. Files identified as new, changed, or removed are actioned if they match a filter. On the first run all files are treated as new and WILL be actioned if they match a filter. If you add a new filter that matches a group of files that have never been actioned they WILL be actioned. The NULL action routine can be used to mark a group of files as actioned prior to adding a new filter. Example configuration file: ! OpenVMS Alpha 7.3-2 Patch Notification ! ! node ftp.itrc.hp.com dir /openvms_patches/alpha/V7.3-2/ recurse false dates false ! inconsistent dates within site ! ! Uncomment this for the first run if you do NOT want to be mailed all ! existing .txt files ! !action * null ! mark all files as actioned ! action .* null ! ignore all files with a leading . action *.txt mail bloggs ! mail .txt files to user BLOGGS Graham Burley