#1 2006-05-26 16:13

eloderma
Member
Registered: 2006-05-26
Posts: 1

Increment number in filename

hi, i'm using your beautifoul program but i don't understand how do do it:

i have this list of files:

1.pdf
2.pdf
3.pdf
4.pdf

and i want to have:

2.pdf
3.pdf
4.pdf
5.pdf

i don't understant how substitute the entire name of file.

thank you

Offline

#2 2006-05-26 20:45

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,379

Re: Increment number in filename

Hi eloderma,

The are two different ways of doing it, I'll explain one... You can't rename directly, because you'll be trying to rename to already existing names, i.e. renaming 1.pdf to 2.pdf, while 2.pdf already exists - you have to do it 2 renaming steps.

Step 1)
* Insert "_" as Prefix;
* Rename, you'll have something like this: _1.pdf, _2.pdf, etc.

Step 2)
* Sort Numerically, so you have: from _1.pdf to _N.pdf appearing in order;
* Delete from position 1 to the end of the file (skip extension);
* Serialize Incremental, index starts at 2, step 1, as prefix;
* Rename, and it's done!

smile

Offline

Board footer

Powered by FluxBB