/* Rexx */

suff = substr(date("W"),1,3)

parse arg command

if words( command ) >2 then do
  Say 'Too many args specified'
  exit
end

log = word( command, 1 )
zip = word( command, 2 )

if log='' then do
  say 'No log-file specified'
  exit
end

if zip='' then do
  say 'No zip-file specified'
  exit
end

Call RxFuncAdd 'SysFileTree', 'RexxUtil', 'SysFileTree'

rc = SysFileTree( log, tree, "FO" )

if rc<>0 then do
  say 'No matched files found'
  exit
end

do i=1 to tree.0

  new = tree.i
  dot = pos('.',new)
  if dot<>0 then new = left( new, dot-1 )
  new = new"."suff

  'copy ' tree.i new
  'del ' tree.i
  'zip -j ' zip new  
  'del ' new

end