David

Since you're on Windows you can run a simple VBScript to check the dates on
the entries.
If you haven't used VBScript on Windows, just create the script in notepad
with a vbs extension and run from a command shell using CSCRIPT
scriptname.vbs or WSCRIPT scriptname.vbs - they are the same, just WSCRIPT
pops up message boxes.

Here is an example - this is pretty much off the top of my head so you may
need to fiddle around with it i.e. it's not warranted in any way and the
actual deletion line is commented out! Should be run from the account
directory.

' script to clear down old entries from a directory

Const DIRNAME = "&PH&" ' change to _PH_ on UniData
Const INTERVAL = 30    ' days

Dim fso

Main

Sub Main
  If CreateFSO = False Then Exit Sub
  If CheckDirectory = False Then Exit Sub
  CheckFiles
End Sub

Function CheckDirectory
   If fso.FolderExists(DIRNAME) = False Then
      WScript.Echo "Missing Directory " & DirName
      CheckDirectory = False
   Else
      CheckDirectory = True
   End if
End Function

Sub CheckFiles
   Dim Folder
   Dim Files
   Dim File

   Set Folder = fso.GetFolder(DIRNAME)
   Set Files = Folder.Files
   If Files.Count > 0 Then
      For Each File In Files
        CheckFile(File)
      Next
   End If
End Sub

Sub CheckFile(File)
   If Left(File.Name,1) = "." Then
      Exit Sub
   End If
   Today = Date
   If DateDiff("d", File.DateCreated, Today) >= INTERVAL Then
     WScript.Echo "Delete " & File.Name & " " & File.DateCreated
     ' UNCOMMENT THIS LINE TO DO THE DELETION File.Delete
   End If
End Sub

Function CreateFSO
   Set fso = CreateObject("Scripting.FileSystemObject")
   If (fso Is Nothing) Or (Err <> False) Then
      WScript.Echo "Cannot initialize file system object"
      CreateFSO = False
   Else
      CreateFSO = True
   End If
End Function

Regards
 
Brian
> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> David Wolverton
> Sent: 09 January 2008 04:29
> To: [email protected]
> Subject: [U2] [UD] Cleaning out _PH_
> 
> Have a _PH_ that is just full of crud and I cannot think of a 
> convenient way to automate the 'cleanup' from within UniData 
> since there is nothing the key to the _PH_ record that shows 
> a 'date' -- the design cleverly stores the User ID and 
> ProcessID - both terribly non-useful for cleanup logic!!  
> 
> How do others deal with this maintenance short of telling 
> users to 'periodically zap the records' -- I could clear data 
> over 120 days old and never lose a moment of sleep, but can't 
> find a way to do this without resulting to 'directory dump 
> parsing', which just seems wrong.
> 
> This is a 'Windows' box, and it appears to have _PH_ entries 
> back to 2006!
> Yikes!
> 
> Thanks for thoughts on this maintenance task...
> 
> David W
> -------
> u2-users mailing list
> [email protected]
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to