rename several files sequentially
Hello everyone,
I am trying to rename some files that do not have a pattern in their names to a sequential names. original file names are in the form of REC92837498, REC9837449 and so on. I want to rename them to REC_1, REC_2...etc. I used the following script: Code:
j=1 what is the proper command to increment j by 1? Thanks. |
Thanks everyone,
I found the problem I should use j = $((j+1) |
Or simply
Code:
(( j++ )) |
Also, have a look here at why using ls to feed a loop is inherently dangerous.
Try something as simple as: Code:
for i in REC* |
Thanks Colucix and Grail for your replies.
Colucix I tried the script and it worked, may be you mean I should reframe it in a more professional way, can you please provide an example on to correct the code? Thanks again. |
All times are GMT -5. The time now is 11:48 AM. |