7FTP_NEW, Utilities, Tracks an FTP Site for File ChangesIFTP_NEW is a command procedure to check an ftp directory or tree for new,changed, or removed files.HThe procedure gets a listing of the directory using DIR/FTP/FULL, parsesJthe output, and stores the file information in an indexed file. The latestHfile information is compared to that stored to identify new, changed, orMremoved files. The procedure can optionally call an action routine to process4a new or changed file based on a simple text filter.$Usage: $ @FTP_NEW CONFIGURATION_FILEHParameters are passed using a configuration file. A configuration recordGconsists of a key and a value separated by whitespace (spaces or tabs).'NODE ftp_server FTP server to contact![TYPE] UNIX|VMS FTP server type0[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)2[DATES] TRUE|FALSE Compare dates (default FALSE)5[CASE] TRUE|FALSE Action filters are case sensitive4[LIMIT] INTEGER Limit the number of action events/[ACTION] filter routine [param] See notes belowJConfiguration using only tabs as separators can be enabled by defining theKlogical FTP_NEW_STRICT_CONFIG to "1", this allows for spaces to be included in values (e.g. directory_name).IThe default configuration file extension is .CFG .The procedure creates aFdata file and a history file. The files are created using the name andGlocation of the configuration file with extensions of .DAT and .HISTORY respectively.GDirectory trees can be processed using the RECURSE option in which case5the procedure calls itself to process subdirectories.CBy default the procedure compares only size information to identifychanges.JThe logical FTP_NEW_DEBUG can be defined to increase the level of logging,e.g. $define FTP_NEW_DEBUG 1Actions-------<An action can be called for a new, changed, or removed file.OThe format of an action configuration entry is (tokens separated by whitespace)! ACTION filter routine [param]B filter - text appears in filename (e.g. *.txt) or * to match all" routine - FTP_NEW routine to call' param - parameter to pass to routineIActions are evaluated in the order they appear in the configuration file,&the first matching action is executed.HThe filter text string is compared with the file name only, i.e. not theHdirectory 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 PARAM1 NOTIFY - mail notification of file to PARAM( NULL - mark the file as actionedG COPY - copy file to directory PARAM using default transfer modeA COPY_ASCII - copy file to directory PARAM using text/ascii mode= COPY_BINARY - copy file to directory PARAM using binary modeH DCL - call DCL command procedure PARAM, the procedure is calledL with P1 remote node, P2 remote directory, P3 remote filename,L P4 reflects the state change - "NEW", "CHANGED", or "REMOVED"F DCL_ASCII - call DCL command procedure PARAM after copying the fileJ 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.IThe datafile records the last successful date an action was processed forHeach file, and will retry failed actions on subsequent runs if required.HDCL action procedures should return a meaningful status value, an actionAis treated as failed if it returns a severity other than SUCCESS.IFiles identified as new, changed, or removed are actioned if they match aJfilter. On the first run all files are treated as new and WILL be actionedGif they match a filter. If you add a new filter that matches a group ofJfiles that have never been actioned they WILL be actioned. The NULL actionHroutine 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!F! 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!4action .* null ! ignore all files with a leading .:action *.txt mail bloggs ! mail .txt files to user BLOGGS(Graham Burley