File revision rename

A swapping-ground for Regular Expression syntax

File revision rename

Postby Kvalitet » Fri Jun 19, 2009 2:34 pm

Hi,

I searched the forum, but could not find anything really similar to what I want to achieve.

Problem:

I have thousands of files with the following structure:

nnnnnn.pdf
nnnnnn_0.pdf
nnnnnn_A.pdf
nnnnnn_B.pdf
...
nnnnnn_X.pdf

where the file without suffix is the current (last) revision
nnnnnn is the current filename
the _X is the second last revision for the specific nnnnnn file
the _X varies from C to G revision for the different nnnnnn files

I want it to look like this:

nnnnnn_A.pdf (nnnnnn_0.pdf)
nnnnnn_B.pdf (nnnnnn_A.pdf)
nnnnnn_C.pdf (nnnnnn_B.pdf)
...
nnnnnn_W.pdf (nnnnnn_X.pdf)
nnnnnn_X.pdf (nnnnnn.pdf)


Example from folder

600001.pdf
600001_0.pdf
600001_A.pdf

600002.pdf
600002_0.pdf
600002_A.pdf
600002_B.pdf

600003.pdf
600004.pdf
600004_0.pdf

600005.pdf
600005_0.pdf
600005_A.pdf
600005_B.pdf
600005_C.pdf


and so on..

should be

600001_A.pdf
600001_B.pdf
600001_C.pdf

600002_A.pdf
600002_B.pdf
600002_C.pdf
600002_D.pdf

600003_A.pdf
600004_A.pdf
600004_B.pdf

600005_A.pdf
600005_B.pdf
600005_C.pdf
600005_D.pdf
600005_E.pdf



Can this be done with BRU or do I have to learn C++? :)

-Kvalitet
Kvalitet
 
Posts: 1
Joined: Fri Jun 19, 2009 2:15 pm

Re: File revision rename

Postby Admin » Mon Jun 22, 2009 1:39 pm

You could try with "replace" , e.g. replace _0 with _A , etc.
Admin
Site Admin
 
Posts: 2351
Joined: Tue Mar 08, 2005 8:39 pm


Return to Regular Expressions