; Client deletes all files in the server's current directory
; that are more than 100 days old.  It's easy to delete local
; files of a given age:
;
;    delete /before:-100days *.*
;
; Here's how to delete remote ones.  Assume a connection already
; exists to a Kermit server and the server's current directory is
; the one you want to delete files from.

.today := \fmjd()                   ; Today's date as Modified Julian Date
query kermit files(*.*)             ; Have server make file list
while true {                                  ; Loop through file list
    query kermit nextfile()                   ; Get next file
    if equal "\v(query)" "" break             ; No more - done
    .name := \v(query)                        ; Remember its name
    query kermit date(\m(name))               ; Get the file date
    .age ::= \m(today) - \fmjd(\v(query))     ; Get file's age in days
    if >= \m(age) 100 remote delete \m(name)  ; Delete if 100 days old
}

