/* RENUM.REX to renumber filenames. */ parse arg rInit pChar pPad if rInit = '' then rInit = 1 if pChar = '' then pChar = 0 if pPad = '' then pPad = 0 call rxFuncAdd 'sysloadfuncs','rexxutil','sysloadfuncs' call SysLoadFuncs Say 'Starting . . .' cDir = Directory() cDir = strip(cDir) say 'CDIR =' cDir if length(cDir) = 3 then chkDir = cDir || '*.*' else chkDir = cdir || '\*.*' say 'ChkDir =' chkDir rc = sysfiletree(chkDir, 'FILE', 'FO') say 'Total files (File.0) =' file.0 do i = 1 to file.0 t = length(cDir) if t = 3 then t = t - 1 t = t + 2 fName = substr(file.i, t) parse value fname with fn1 '.' fext fn1 = i say 'fn1 =' fn1 'and fname =' fname if length(fn1) < pPad then do dPad = pPad - length(fn1) pFil = copies(pChar, dPad) pFix = pFil || fn1 end else pFix = fn1 pct = ( i / file.0 ) * 100 say fName 'is being renamed to' pFix || '.' || fext '==>' right(i,4) 'of' file.0 format(pct,3,2)'%' 'ren' fName pFix || '.' || fext end exit