| T.R | Title | User | Personal Name
 | Date | Lines | 
|---|
| 1819.1 | Try TITLE.EXE | JGODCL::BLOEMENDAL | Wim, JGO B-1/06, 889-9364 | Wed Feb 26 1997 03:09 | 60 | 
|  | >    I have a customer who wants to clean up his user's mail files.
>    He would like to basically DELETE with the /BEFORE qualifier.
>    Does anyone have a DCL command procedure written which they could
>    share that will accomplish this?
  I have (JGODCL::USERDISK10:[BLOEMENDAL.TOOLS]) (see below for origin)
  a program called TITLE.EXE (& .HLB), which allows:
$ set noon
$ here=f$env("procedure")
$ x="$" + f$parse(here,,,"device") + f$parse(here,,,"directory") + "TITLE.EXE"
$ x move "The review manager" Newmail Wastebasket
$ x sync
  This I used to 'move' some annoying messages from the "NEWMAIL" folder to the 
  "WASTEBASKET"
  Below some extract from the help file.  Sounds what you're looking for. 
  Goodluck,
    _Wim_
Topic? old
Old_Mail
   search the input folder/file for messages
   that are older than the date/time specified with the /BEFORE qualifier
   and move them to an output folder/file  (default for file is your
   normal mail file
   Old    /Before=Date/Time From_Folder   To_Folder
  Additional information available:
  Delete     /BEFORE=date_time     From_Folder           To_folder  Examples
Topic? HELP
   Allows you to move Mail message between Mail folders/files in
   ways not permitted by VMSmail
   program created by Peter Bailey  (JUNO::Bailey) in some spare moments
   disclaimer:   use at own risk (but it seems to work for me)
   Any problems and I'll try to fix them
   Any extensions and I'll give it a go
 | 
| 1819.2 | I'm really looking for the actual code | KAOFS::P_CHAPLINSKY |  | Wed Feb 26 1997 11:45 | 18 | 
|  |     I couldn't get the file TITLE.HLB ... network partner exited.  So when
    I tried to run the executable it returned:
    
    $ run title
    %DCL-W-ACTIMAGE, error activating image NOTES$SHARE
    -CLI-E-IMAGEFNF, image file not found
        CTHU25$DKA100:[SYS0.SYSCOMMON.][SYSLIB]NOTES$SHARE.EXE;
    
    Not surprising.  Anyway, I wouldn't give an executable to a customer.
    I was simply looking for some DCL code that might exist already to
    ASSIST the customer in writing his own code.  I'm not sure I like the
    idea for deleting user mail messages anyway.  Set up some quotas
    and when there used up, believe me, the user will do his own cleanup.
    
    Thanks anyway,
    
    PChaplinsky
    OpenVMS Support Team
 | 
| 1819.3 |  | AUSS::GARSON | DECcharity Program Office | Wed Feb 26 1997 18:15 | 15 | 
|  |     re .0
    
    What's the problem?
    
    MAIL> DIR/BEFORE=xxxx [folder]
    MAIL> DEL/ALL
    
    This will delete the selected messages i.e. selected on the basis of
    received time.
    
    All you have to do is do this for each folder for each user (SMOP).
    
    Needless to say that it would be a good idea to run this immediately
    after an image backup in case it goes haywire.
                                                  
 | 
| 1819.4 | If he knew everyones password | KAOFS::P_CHAPLINSKY |  | Thu Feb 27 1997 10:50 | 12 | 
|  |     Yes from the "MAIL>" prompt you can easily accomplish the task.
    It's to get to the prompt of another user's account that poses a
    problem.
    
    As system manager, he wants to set up a rule, that all mail messages
    older than a year will automatically be deleted.  He wants to 
    accomplish this by regularly running a DCL command procedure or a program
    from priviledged account.
    
    Thanks for the suggestion,
    
    PChaplinsky
 | 
| 1819.5 | MAIL> SET FILE | IOSG::PYE | Graham - ALL-IN-1 Sorcerer's Apprentice | Thu Feb 27 1997 14:16 | 3 | 
|  |     He doesn't need their passwords, only the name of their mail files, and
    acces to them. Then MAIL SET FILE disc:[direct] will enable you to
    perform commands on other user's mail.
 | 
| 1819.6 |  | AUSS::GARSON | DECcharity Program Office | Thu Feb 27 1997 16:51 | 6 | 
|  |     re .4,.5
    
    Or use the command procedure with $ SUBMIT/USER=xxxx for each user.
    
    A disadvantage of MAIL> SET FILE is that you have to know where a user has
    his mail file which may not be the default or even sensible.
 | 
| 1819.7 | Quick hack | SPSEG::PLAISTED | Subspace Gaseous Anomaly | Thu Feb 27 1997 19:41 | 145 | 
|  | $  On CONTROL_Y    Then Goto Cleanup
$  On SEVERE_ERROR Then Goto Cleanup
$
$  Gosub Define_Symbols
$  Gosub Find_Mail_Directory
$  Gosub Create_Cleanup_Procedure
$  Exit
$Find_Mail_Directory:
$
$  OldVerifyState = F$Verify( 0 )
$  Define Sys$Output WorkFile
$  Mail
Show Mail_Directory
Exit
$  Deassign Sys$Output
$  Void = F$Verify( OldVerifyState )
$
$  Open/Read  TheFile  WorkFile
$MailFileLoop:
$  Read       TheFile  TheRecord
$  If F$Locate( MailToken0, TheRecord ) .Eq. F$Length( TheRecord ) Then -
      Goto MailFileLoop
$  Close      TheFile
$
$  Start          =  28
$  Length         =  F$Length( TheRecord ) - Start - 1
$  MailDirectory  =  F$Extract( Start, Length, TheRecord )
$
$  Return
$Define_Symbols:
$  Display           :=  Write Sys$Output
$  ThisProcedure      =  F$Environment( "PROCEDURE" )
$  ThisProcedureName  =  F$Parse( ThisProcedure ,,, "NAME" )
$  ThisPID            =  F$Getjpi( "", "PID" )
$  WorkFile           =  ThisProcedureName + "." + ThisPID
$  MailToken0         =  "Your mail file directory is"
$  MailToken1         =  "Listing of folders in"
$  MailToken2         =  "Press CTRL/C to cancel listing"
$  TheDate            =  F$Cvtime( "-365-", "ABSOLUTE", "DATE" ) !One year ago
$
$  Define WorkFile 'WorkFile'
$
$  Return
$Create_Cleanup_Procedure:
$  Directory/Output=&WorkFile/Exclude=MAIL$*.MAI/NoHeader/NoTrailer 'MailDirectory'
$
$  If F$File_Attributes( WorkFile, "EOF" ) .Eq. 0
$  Then
$    Display "Unable to find any mail files."
$    Exit
$  EndIf
$
$  Open/Read   FileList            WorkFile
$
$Loop:
$  Read/End_Of_File=EOF  FileList  NextFile
$  Define/NoLog NextFile 'NextFile'
$
$  OldVerifyState = F$Verify( 0 )
$  Define Sys$Output WorkFile
$  Mail
Set File NextFile
Directory/Folders
Exit
$  Deassign Sys$Output
$  Void = F$Verify( OldVerifyState )
$
$  State = 0
$  Open/Read  FolderList  WorkFile
$  Open/Write Procedure   WorkFile
$  Write  Procedure  "$Mail"
$  Write  Procedure  "Set File NextFile"
$
$FolderLoop:
$  Read/End_Of_File=FolderEOF  FolderList  FolderLine
$  FolderLine = F$Edit( FolderLine, "COMPRESS,TRIM" )
$  Goto State_'State'
$State_0:
$  If F$Locate( MailToken1, FolderLine ) .Lt. F$Length( FolderLine ) Then -
      State = 1
$  Goto FolderLoop
$State_1:
$  If F$Locate( MailToken2, FolderLine ) .Lt. F$Length( FolderLine ) Then -
      State = 2
$  Goto FolderLoop
$State_2:
$  If F$Length( FolderLine ) .Gt. 0
$  Then
$    Call DeleteFromFolder "''F$Element( 0, " ", FolderLine )'"
$    Call DeleteFromFolder "''F$Element( 1, " ", FolderLine )'"
$  EndIf
$  Goto FolderLoop
$FolderEOF:
$  Close  FolderList
$  Close  Procedure
$  @'WorkFile'	!Execute cleanup
$  Goto  Loop
$EOF:
$  Close  FileList
$
$  Return
$DeleteFromFolder: Subroutine
$  FolderName = F$Edit( P1, "COMPRESS,TRIM" )
$
$  If F$Length( FolderName ) .Gt. 0 Then -
      Write Procedure "Delete/Before=", TheDate, " ", FolderName
$
$  Exit
$EndSubroutine
$CloseFile: Subroutine
$  Logical  =  P1
$
$  If F$Trnlnm( Logical ) .Nes. "" Then Close 'Logical'
$
$  Exit
$EndSubroutine
$Cleanup:
$  Call CloseFile TheFile
$  Call CloseFile FolderList
$  Call CloseFile Procedure
$  Call CloseFile FileList
$
$  If F$Search( WorkFile ) .Nes. "" Then Delete 'WorkFile';*
$
$  Exit
 |