Rename a special Filetype

Advanced Renamer forum
#1 : 02/01-18 17:12
GSComputer
GSComputer
Posts: 8
I would like to rename the following Filetype

(01) GSComp Bericht No 02 vom 23. Januar 2018 MisterB (230517).pdf
rename in
GSComp 02 2018.pdf

There can be the the following differences in the phrase
01 01-99
23 01-31
MisterB different Count of letters
(230517) different Count of numbers

My greatest problem are ( )
Please help me.
Thanks in advance


02/01-18 17:12
#2 : 12/01-18 12:45
Cynthia Angela
Cynthia Angela
Posts: 7
This is not a problem at all. You can simply remove ( ) and write date in 12-1-2018 format not in 12/1/2018 format.


12/01-18 12:45
#3 : 12/01-18 13:03
Stefan
Stefan
Posts: 274
Reply to #1:
@GSComputer

please provide a few 'before' / 'after' examples.

Before/Actual:
x
x
x

After/wanted:
y
y
y



Thanks.

- - -



FROM:
(01) GSComp Bericht No 02 vom 23. Januar 2018 MisterB (230517).pdf
TO:
GSComp 02 2018.pdf

is not possible to guess how to spot the wanted parts from that name.
You have to find some common rule, like "second word", or "first hyphen" or "after first digit"....






 


12/01-18 13:03
#4 : 15/01-18 13:25
Shweta Patil
Shweta Patil
Posts: 1
Reply to #1:
yes exactly you just have to remove an rounded parenthesis and also have to change the format of date.
Then simply your problem will solve.


15/01-18 13:25
#5 : 01/02-18 04:49
Brian Hanlon
Brian Hanlon
Posts: 29
Reply to #1: Let's have a go at this, and show you the steps:

Get rid of the "(nn) ", including the space after ')':

Rule 1:
Remove 5 starting at 1
Remove Count: 5
Starting at: 1

Now get rid of the constant unwanted 'words':

Rule 2:
Replace "Bericht No " (No quotes, note the space at the end)
also replace "vom " (No quotes, note the space at the end)

Replace with: Nul, Nothing

so the Method box looks like:

Text to be replaced: "Bericht No \vom " (No quotes, note the spaces)
Replace with: "" (No quotes, note that there is NOTHING in this place)

After these two Rules, your example would look like:

GSComp 02 23. Januar 2018 MisterB (230517).pdf

So now we need to start into RegExp to get rid of the last two 'words' and 'words' three and four:

Rule 3:
Replace: "GSComp (\d\d) \d\d\W (\w*) 2018 (.*)$"
with: "GSComp \1 2018"
Check the 'use regular expressions' box.

Those hieroglyphics set up a RegExp where we start with the literal 'GSComp '
then the (\d\d) refers to the '02' with a reference of '\1'
then the \d\d\W specify two digits plus a non-word character (the period '.')
then (\w*) stores the 'MisterB' with a reference of '\2' just in case you need it later
then we have the literal ' 2018 ' followed by 0 or more characters (any) to the end-of-line '$'
Note that spaces ARE important, and can cause much head-scratching when a RegExp doesn't do what we think it will do.

The replacement text makes use of the '\1' reference to put that No 'nn' where we want it, with the literals making up the rest. (We could put a '\2' in there, to include the 'MisterB' bit if we needed to.)

With those three Rules set up, it is time to test:

BEFORE:
C:\TESTING>DIR /B
(01) GSComp Bericht No 02 vom 23. Januar 2018 MisterB (230517).pdf
(66) GSComp Bericht No 02 vom 31. Januar 2018 MrsJones (13).pdf
(77) GSComp Bericht No 05 vom 17. Januar 2018 MissRedhead (514).pdf
(88) GSComp Bericht No 06 vom 14. Januar 2018 MrBH (0515).pdf
(99) GSComp Bericht No 07 vom 01. Januar 2018 MisterB (30516).pdf

Running AR with the above three Rules, produces:

C:\TESTING>DIR /B
GSComp 02 2018~001.pdf
GSComp 02 2018~002.pdf
GSComp 05 2018.pdf
GSComp 06 2018.pdf
GSComp 07 2018.pdf

and from the 'undo' file:

file000000=C:\TESTING\(01) GSComp Bericht No 02 vom 23. Januar 2018 MisterB (230517).pdf|C:\TESTING\GSComp 02 2018~001.pdf
file000001=C:\TESTING\(66) GSComp Bericht No 02 vom 31. Januar 2018 MrsJones (13).pdf|C:\TESTING\GSComp 02 2018~002.pdf
file000002=C:\TESTING\(77) GSComp Bericht No 05 vom 17. Januar 2018 MissRedhead (514).pdf|C:\TESTING\GSComp 05 2018.pdf
file000003=C:\TESTING\(88) GSComp Bericht No 06 vom 14. Januar 2018 MrBH (0515).pdf|C:\TESTING\GSComp 06 2018.pdf
file000004=C:\TESTING\(99) GSComp Bericht No 07 vom 01. Januar 2018 MisterB (30516).pdf|C:\TESTING\GSComp 07 2018.pdf

Note that I have AR set to resolve name collisions by appending a number and use the tilde '~' as separator - that is why no error was thrown with the Name Collision of the first two, AR simply appended '~001' and '~002' as instructed.

If the No 02 does NOT change, you will end up with a LOT of ~nnn filenames, however, I suspect that it does change, therefore I included one non-changed and three changed in the test data.

Hope that this long post helps you get the job done.

Brian

Postscript:
I forgot to mention that the 'undo' file uses 'Tabs' instead of 'spaces' in the filenames, as a very clever method of avoiding quoted / non-quoted filenames. - That's why that part looks a bit odd.


01/02-18 04:49 - edited 01/02-18 04:53