#!/usr/local/bin/tclsh 
##  Copyright 1996, Richard M. Troth, all rights reserved.  <plaintext> 
# 
#	  Name: uftprune (a Tcl script) 
#		Unsolicited File Transfer, aged spool file purging 
#	Author: Rick Troth, Houston, Texas, USA 
#	  Date: 1996-Mar-11 
# 
 
set MAXAGE 100 
set UFTDIR /usr/spool/uft 
 
# 
# work from the right directory: 
cd $UFTDIR 
 
# 
# calculate a reference file mod time: 
exec touch /tmp/[pid].tmp 
file stat /tmp/[pid].tmp REF 
exec rm /tmp/[pid].tmp 
 
# 
# list all processable files: 
set UFTFILES [glob -nocomplain */*] 
 
# 
# loop ... 
while {$UFTFILES != ""} { 
	# pluck-off one item from the list: 
	set UFTFILE [lindex $UFTFILES 0] 
	# then strip it from the list: 
	set UFTFILES [lrange $UFTFILES 1 end] 
	# check it out ... 
puts stdout "checking $UFTDIR/$UFTFILE" 
	if {[file type $UFTFILE] == "directory"} \
		then { exec rm -r $UFTFILE; continue } 
	file stat $UFTFILE UFTSTAT 
	set AGE [expr $REF(mtime) - $UFTSTAT(mtime)] 
	set AGE [expr $AGE / 86400] 
	if {$AGE > $MAXAGE} then { 
puts stdout "removing $UFTDIR/$UFTFILE" 
		exec chmod 222 $UFTFILE 
		exec rm $UFTFILE } 
#	puts stdout "$UFTFILE $UFTSTAT(type) $AGE" 
	} 
 

#!/bin/sh 
# 
#	  Name: uft.h 
#	  Date: 1996-May-2 
# 
 
# 
# 
cd /usr/spool/uft/$LOGNAME 
 

