Macro to save a file on change
?tacl macro
== ****************************************************************************
== * Macro  : ZCOLLECT                                                        *
== * Purpose: To save a file each time its modification date changes          *
== * Syntax : RUN ZCOLLECT SourceFile SaveFile Beg End                        *
== * Example: run zcollect $DATA.LOGFILE.LOG $DATA.SAVEFILE.LOG 20 25         *
== *          -------------------------------------------------------         *
== * Narrative:                                                               *
== * Check $DATA.LOGFILE.LOG's timestamp against $DATA.SAVEFILE.LOG20         *
== * If its different, it will                                                *
== *          fup dup $DATA.LOGFILE.LOG, $DATA2.SAVEFILE.LOG20,sourcedate     *
== * It will then set up for -> $DATA.SAVEFILE.LOG21                          *
== ****************************************************************************
#push SourceFile SaveFile BegAt EndAt
#set  SourceFile %1%
#set  SaveFile   %2%
#set  BegAt      %3%
#set  EndAt      %4%

[#if ([#fileinfo/existence/[SaveFile][BegAt]])
|then|
==  The first file already exists. Do nothing.
|else|
==  Grab the first file
    fup dup [SourceFile],[SaveFile][BegAt],sourcedate
]
 
[#loop |do|
   [#if (
        [#fileinfo/modification/[SourceFile]] =
        [#fileinfo/modification/[SaveFile][BegAt]]
        )
   |then|
       delay 5 mins == This pause can be mins, hours or secs
   |else|
       #set  BegAt [#compute [BegAt] + 1]
       #output fup dup [SourceFile],[SaveFile][BegAt],sourcedate
       fup dup [SourceFile],[SaveFile][BegAt],sourcedate
   ]
|until| (BegAt = EndAt)
]

Sunday, August 2, 2009 9:34:03 AM, From: jim, To: Tandem