home *** CD-ROM | disk | FTP | other *** search
- /*
-
- $VER: CleanUp 2.00 (23-DEC-92)
-
- © 1992 by Robert Hofmann 2:2400/24@fidonet.org
-
-
- */
-
- LogFile = 'logs:TD.log'
-
- Directory.1 = 'BAK:'
- RemainingDays.1 = 2
-
- Directory.2 = 'Outbound:'
- RemainingDays.2 = 30
-
- Directory.3 = 'Inbound:'
- RemainingDays.3 = 90
-
- Directory.4 = 'T:'
- RemainingDays.4 = 1
-
- Directory.5 = 'DH2:BAD'
- RemainingDays.5 = 7
-
- /* and so on... */
-
-
- arg mode
-
- ver = 'v2.0'
- if find(mode, 'QUIET') = 0 then do; say; say ' *** CleanUp' ver '***'; say ' ~~~~~~~~~~~~'; say ' © 1992 by Robert Hofmann 2:2400/24@fidonet.org'; say
- say ' (Actual date:' translate(date(),'-',' ') time()')'; say; say; end
-
- if ~show(l, "rexxsupport.library") then
- if ~addlib("rexxsupport.library", 0, -30, 0) then do
- say "*** Error: Couldn't access rexxsupport.library!"; exit; end
-
- Now = date('I'); count = 0; delcount = 0; nr = 0
-
- do n=1 while Directory.n ~= 'DIRECTORY.'n
-
- if right(Directory.n,1) ~= ':' & right(Directory.n,1) ~= '/' then Directory.n = Directory.n'/'
- files = showdir(Directory.n, 'F')
-
- do until files = ''; parse var files check files
- file = upper(Directory.n || check); Days = word(statef(file),5)
- datum = translate(date('N',days,'I'),'-',' '); count = count + 1
- if now-days > RemainingDays.n then do; length = word(statef(file),2) 'bytes.'
- if find(mode, 'QUIET') = 0 then do; say ' * File <'file'>,' length
- say ' is older than' RemainingDays.n 'days ('Datum'), deleting...'; say; end
- delcount=delcount+1; nr=nr+1; line.nr = time() upper(' "'file'"') Datum 'deleted...'
- if find(mode, 'DELETE') ~= 0 then call delete(file)
- end
- end
- end
-
- if logfile ~= '' & find(mode, 'DELETE') ~= 0 then do
- if ~exists(logfile) then call open('log',logfile,'W')
- else call open('log',logfile,'A')
- datum = date(); if left(datum,1) = '0' then datum = ' 'right(delstr(translate(datum, '-', ' '), 8, 2),8)
- else datum = delstr(translate(datum, '-', ' '), 8, 2)
- do n=1 to nr; logstr = 'C' datum line.n; call WriteLn('log',logstr); end
- call WriteLn('log', 'C' datum time() ' *** Checked' count 'files,' delcount 'deleted. ***')
- call close('log')
- end
-
- if find(mode, 'QUIET') = 0 then do; say; say ' ==>> Checked' count 'files,' delcount 'deleted. <<=='; say; end
-
-