Arrays, variables, and renaming!

Never coded before, just learning some recently to ease a few work tasks...
For work, I sometimes need to rename jpegs. Each image has two numbers, a beginning and end for what is in each image. The end of one box is the same number as the beginning for next box (no gaps).
I thought if I went through and named each file as the ending number, I could automate the rest of the naming process.
I've saved all the file names into an array, but I can't get the correct image name to be output into the "newname" variable of the rename function.
The format for the name: XX123-45_BOX1_0.00-999.99M
The first 12 characters are input by the user earlier in the code since they are the same for every image. The number after "BOX" goes up consecutively. The "0.00-999.99" are where the numbers are changing them most, and the last character is "M" (not including the extension).

How do I get the proper "newname" that I want?! Here is the code for the part I am having trouble with...




for(boxnum = 1; boxnum < (numfiles - omit); boxnum++)
{
char oldname[] = "%c%c", DirSpec, nameArray[x];
if(boxnum = 1)
{
char newname[] = "%c_BOX1_0.00-%cM", boxinfo, nameArray[x];
boxnum++;
x++;
}
else
{
char newname[] = "%c_BOX%d_%c-%cM", boxinfo, nameArray[x], nameArray[y];
x++;
y++;
}
}
Topic archived. No new replies allowed.