home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / comm / mail / YAMscripts.lha / DeleteOld.rexx < prev    next >
OS/2 REXX Batch file  |  1996-11-26  |  1KB  |  44 lines

  1. /*                            DeleteOld.rexx
  2.                  v1.0 - 22-Nov-96
  3.  
  4. This script will mark all messages older than limit days as deleted.  It doesn't
  5. automatically remove them, unless variable auto_rem is set to 'YES'.  The date
  6. of a message is read from the file, not from message headers.
  7.  
  8. Send suggestions and bug reports to knikulai@utu.fi
  9. */
  10.  
  11. options results
  12. limit=30    /* All messages older than limit days, will be deleted */
  13. ask_conf='YES'  /* If set to YES, a requester is displayed first */
  14. auto_rem='NO'   /* If this variable is set to YES, messages are not just marked
  15.                    as deleted, they are really removed from the disk.  There is
  16.            no way you can undelete them from YAM, so be careful! */
  17. addlib(rexxsupport.library, 0, -30, 0)
  18. today=date(I)
  19.  
  20. address 'YAM'
  21. if ask_conf=='YES' then do
  22.    foo=date(N,today-limit,I)
  23.    'Request "Are you sure you want to delete messages*nreceived before P[2]'||foo||'P[1]?" "_Yes|_No"'
  24.    if result=0 then exit
  25. end
  26. 'GetFolderInfo Max'
  27. n=result
  28.  
  29. do msg=0 to n-1
  30.     'SetMail' msg
  31.     'GetMailInfo File'
  32.     fname=result
  33.     fi=statef(fname)
  34.     parse var fi ft bytes blocks flags days .
  35.     if limit<today-days then do
  36.         if auto_rem=='YES' then
  37.         call delete(fname)
  38.     else
  39.         'MailDelete'
  40.     end /* if limit<today-days then */
  41. end /*do msg=0 to n-1*/
  42. if auto_rem=='YES' then address 'YAM' 'MailUpdate'
  43. exit
  44.