Jens,

I'm written a basic inventory system which tracks workstation info into a master file (COMPUTERS.CSV) as well as records individual workstation files (WRKSTN1.TXT). My procedures update the master and individual workstation file if they haven't been updated for at least 7 days. I found that as people changed workstation names the old individual files remained (WRKSTN1.TXT, RIXWS.TXT, LAPTOP.TXT) even though they all referred to the same workstation. I've since changed my naming scheme to reflect the MAC address of the NIC card, (eg WRKSTN1.00B0D6C9181A.TXT). Now in my clean-up process I want to find any previous instances but I want do delete all but the most recent.

Anyways I think I solved my dilima with:
$hw_dir="S:\Inventory\Hardware\"
$addrpattern=$hw_dir+"*."+@ADDRESS+".txt"
$wkstxt=$hw_dir+@WKSTA+"."+@ADDRESS+".txt"
$delfile=$hw_dir+Dir("$addrpattern")
WHILE $delfile<>$hw_dir
IF $delfile<>$wkstxt
DEL $delfile
ENDIF
$delfile=$hw_dir+Dir()
LOOP

This may not be elegant, but for my purposes I got it working.

I was somewhat curious what criteria Dir() used to return a search value.

Thanks!