Subj : Re: Howto copy set of files with rename to shorter name? To : All From : Jonathan de Boyne Pollard Date : Sat Mar 09 2002 05:05 am From: Jonathan de Boyne Pollard AB> I have a lot of files with name pattern: LONGNAME_XX-YY.ext, where AB> XX and YY are changing numbers and LONGNAME is string which is same AB> for all files. I need to copy them and change their names to AB> _shorter_ name while preserving the numbers: FOO-XX-YY.ext. Using 4NT () : for %f in ( longname-[0-9][0-9]-[0-9][0-9].txt ) rename %f F00-%@instr[9,5,%f].txt Using REXX : /* Incorrect capitalisation to accommodate broken Win32 REXXUTIL.DLL port */ call RxFuncAdd 'SysMoveObject','rexxutil','sysmoveobject' call RxFuncAdd 'SysFileTree','rexxutil','sysfiletree' error = SysFileTree("longname-??-??.txt","files","BO") do i = 1 to files.0 /* Work around _another_ Win32 REXXUTIL.DLL bug */ if left(files.i,1) == '.' then files.i = right(files.i,length(files.i)-1) newname = "F00-"||substr(files.i,10,5)||".txt" error = SysMoveObject(files.i, newname) if error \= 0 then say 'Error' error 'renamimg "'files.i'" to "'newname'"' end --- BBBS/NT v4.01 Flag-2 * Origin: Mach2 Systems (1:342/3) .