Efficient File Name Changes: How to Automate the Process with Programming

  • Thread starter n1person
  • Start date
  • Tags Tags
    File
3 replies · 3K views · last reply
n1person
Messages
144
Reaction score
0
Hello all,

I have another little computer problem to deal with. I have a folder full of files (over a thousand) with the basic form KJ(number)-j(another number).txt, and I want to change the style to (number)(another number).txt. Is there any simple way to do this as the only way I can think of is a program which opens the file, opens a new file, copies the contents from the open file to the new file, and closes the two files, which seems timely and rather inefficient.

Thanks for your help!
 
There is also the more general problem of turning (2 random letters)(number)-(2 other random letters)(another number).txt --> (number)(another number).txt
 
<io.h> or <stdio.h>

int rename(
const char *oldname,
const char *newname
);

Such things can be located just by googling.