home *** CD-ROM | disk | FTP | other *** search
- /*
- * purge version 1.0
- *
- * ARexx script to delete old news articles.
- * Usage: purge.rexx <active file> <days>
- *
- * Written by David Jameson, 1994.
- */
-
- arg active_filename number_days
-
- /* Open RexxSupport library */
-
- if ~show('L', 'rexxsupport.library') then do
- if addlib('rexxsupport.library', 0, -30, 0) then
- say 'added rexxsupport.library'
- else do
- say 'failed to open rexxsupport.library'
- exit 10
- end
- end
-
- /* Calcaulate date before which articles will be deleted */
- days = date('I')
- days = days - number_days
- newdate = date('E', days, 'I')
- newdate = translate(newdate, '-', '/')
-
- if ~open('active_file', active_filename, 'R') then do
- say "Can't open active file" active_filename
- exit 10
- end
-
- address command
- 'resident c:delete' /* for speed */
-
- do until eof('active_file')
- /* Read next line of active file */
- nextline = readln('active_file')
- parse var nextline newsgroup hi lo status
-
- if newsgroup ~= "" then do
- say 'Purging articles from newsgroup ' newsgroup '...'
-
- /* Convert newsgroup name into directory name */
- directory = 'uunews:'||translate(newsgroup, '/', '.')
-
- /* Delete articles with creation date on or before 'newdate' */
- if directory ~= 'uunews:' then do
- 'list ' directory 'files upto ' newdate ,
- ' lformat "delete %p%n" to t:purge_articles'
- 'execute t:purge_articles'
- 'delete >nil: t:purge_articles'
- end
- end
-
- say ""
- end
-