renaming 4000+ files 
Author Message
 renaming 4000+ files

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.

Using 4NT :

        set n=0

Using REXX :

        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



Mon, 13 Sep 2004 05:14:27 GMT  
 renaming 4000+ files

|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.



Wed, 15 Sep 2004 00:07:36 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Printing to Canon 4000 Series--How to change orientation

2. CANON 4000 laser printer

3. FS; Jupiter Ace 4000

4. Adtech AX 4000

5. Find Driver for ADAMS 4000 series

6. Intel SatisFAXition 4000 - 4 port fax/modem

7. How do I run 4000 series ADAM Modules in LabView

8. User code = 4000

9. CosmoPlayer and Fire GL 4000 do not work together

10. Resetting problem on Xilinx 4000 series

11. Is 4000 a leap year?

12. the year 4000 problem

 

 
Powered by phpBB® Forum Software