Subj : Re: renaming 4000+ files To : Jonathan de Boyne Pollard From : GerardS Date : Fri Mar 29 2002 10:07 am From: GerardS@f3.n342.z1.cereal.mv.com (GerardS) Subject: Re: renaming 4000+ files From: "GerardS" | Jonathan de Boyne Pollard wrote: |ML> I have a lot (4000+) files with the naming pattern "randomname.etn" |ML> I would like to rename them to the patern "name****.etn" where **** is a 4 |ML> digit number, in sequence. ---[---snipped---]---| | call RxFuncAdd 'SysFileTree','rexxutil','SysFileTree' | call RxFuncAdd 'SysMoveObject','rexxutil','SysMoveObject' | rc = SysFileTree("*.etn","files","BO") | do i = 1 to files.0 | targetname = 'name'||translate(format(i,4),'0',' ')||'.etn' | error = SysMoveObject(files.i, targetname) | if error \= 0 then | say 'Error' error 'renaming "'files.i'" to "'targetname'"' | end I did a little diddling; I noticed that you set the rexx var RC in statement 3, but don't use it, so here is my version: call RxFuncAdd 'SysFileTree', "rexxutil",'SysFileTree' call RxFuncAdd 'SysMoveObject',"rexxutil",'SysMoveObject' call SysFileTree "*.etn",'files',"BO" do j=1 to files.0 ttt='name'right(j,4,0)".etn" r=SysMoveObject(files.j,ttt) if r\==0 then say 'Error' r 'renaming "'files.j'" to "'ttt'"' end __________________________________________________________________ Gerard S. -- |Fidonet: GerardS 1:342/3 | | Origin: The Cereal Port BBS (603)899-3335 199.125.78.133 (1:132/152) --- # Origin: (1:132/152.4) * Origin: Baddog BBS (1:218/903) .