Help with Expression that will Replace part of File name

A swapping-ground for Regular Expression syntax

Help with Expression that will Replace part of File name

Postby ErynLyn » Fri Jan 10, 2014 8:00 pm

Greetings All.

I have been reading the forums and I am still very confused on how to create a Rename Parse File.
I have alot of textures I need to rename very specifically for a database.
Spent a few hours setting up actions in photoshop to make things a bit easier.
So what I am trying to make is a way to change a find and replace part of a file name.

EX.
HeadTexture_Color-copy to HeadTexture_Color_Pale
HeadTexture_Color-copy-1 to HeadTexture_Color_Tan
HeadTexture_Color-copy-2 to HeadTexture_Color_Pink
so on and so forth
I need it to keep the first part with the underscores and replace the -copy parts with the proper _SkinTone

I have tryed setting it up like this

-copy|_Pale
-copy-1|_Tan
-copy-2|_Pink

But I have a feeling I am not understanding what I am reading/doing enough to do this on my own.
Any Help would be greatly appreciated.

Thank-you all for your time and assistance.
I look forward to hearing back from you and learning something new today.

ErynLyn
ErynLyn
 
Posts: 5
Joined: Fri Jan 10, 2014 7:51 pm

Re: Help with Expression that will Replace part of File name

Postby Stefan » Fri Jan 10, 2014 9:18 pm

Hi and welcome.

I think I can't follow you. Your explanation makes no sense to me.


Please post a few before/after example file names like

Origin file name:
xxxxx yyyy copy.ext

Wanted file name:
xxxxx yyyy.ext



.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Help with Expression that will Replace part of File name

Postby ErynLyn » Fri Jan 10, 2014 9:58 pm

Hello,

Original file name:

HeadTexture_Color-copy.png
HeadTexture_Color-copy-1.png
HeadTexture_Color-copy-2.png

Wanted file name:

HeadTexture_Color_Pale.png
HeadTexture_Color_Tan.png
HeadTexture_Color_Pink.png

Sorry about that :D

Look forward to hearing back.
ErynLyn
 
Posts: 5
Joined: Fri Jan 10, 2014 7:51 pm

Re: Help with Expression that will Replace part of File name

Postby Stefan » Fri Jan 10, 2014 10:51 pm

OK, that's better. But I still do not see any rule.

From where should one know which "copy" to change to which _SkinTone????

Or do you have many different sets of three files each with pale,ten and pink? If yes, you could do:

1.) set "Options > Ignore... > File Extensions" so we can use the last dot as anchor to match the right "copy".
2.) Repl.(3)
Replace: -copy.
With: _Pale.

And so on:
-copy-1. >> _Tan.
-copy-2. >> _Pink.


ErynLyn wrote:Hello,

Original file name:

HeadTexture_Color-copy.png
HeadTexture_Color-copy-1.png
HeadTexture_Color-copy-2.png

Wanted file name:

HeadTexture_Color_Pale.png
HeadTexture_Color_Tan.png
HeadTexture_Color_Pink.png

Sorry about that :D

Look forward to hearing back.


Please wait a few seconds then submit. Thank you.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Help with Expression that will Replace part of File name

Postby Stefan » Fri Jan 10, 2014 11:02 pm

Or do you want to "Renaming From A Text File" ? :shock:

ErynLyn wrote: I am still very confused on how to create a Rename Parse File.

I have tryed setting it up like this

-copy|_Pale
-copy-1|_Tan
-copy-2|_Pink





Then you have to do it exactly as shown in the help

Code: Select all
Renaming From A Text File

Starting with version 2.2.6.0 it is possible to rename files according to a text-file.
This text file should contain a list of "old name" and "new name" pairs, separated by a pipe symbol ( | ).

To use this facility, create a text file in for the correct format, for example:

Track001.mp3|Headlong.mp3
Track002.mp3|Rushes.mp3
TRACK003.mp3|AnywhereIs.mp3



As you see, there is one entry per line.

Next, click the Import option on the File menu and load your file.
If the file is valid then you will see the "new name" column reflecting the contents of the text file.


When comparing the current filename with the text file the application ignores the case of
the filename, e.g. it will happily match Track001.mp3 and TRACK001.mp3.
This makes it easy to rename the files.


As you can see:
Full Origin File name.ext|Full wanted file name.ext

Not parts only
-copy|_Pale



Please wait a few seconds then submit. Thank you.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Help with Expression that will Replace part of File name

Postby ErynLyn » Sat Jan 11, 2014 1:30 am

So from what I am reading, I will have to manually go though and Replace -copy-# with the proper _SkinTone.

Unless I want to make a Rename from Text file for each different set of textures.

any ideas on a speedy way i could generate a Rename from Text file for each different set of textures?

Thank-you all for the information and support I truly appreciate it.

Eryn
ErynLyn
 
Posts: 5
Joined: Fri Jan 10, 2014 7:51 pm

Re: Help with Expression that will Replace part of File name

Postby ErynLyn » Sat Jan 11, 2014 2:12 am

So I set up something in Excel, as I realized messed up all the manual replace renames I did this morning.

But the rename from text parse file doesn't seem to work, or im doing it wrong.

Old File name

CreatureType_Head_wrongspelledword_SkinTone.png
CreatureType_Head_wrongspelledword_SkinTone2.png
CreatureType_Head_wrongspelledword_SkinTone3.png

New File name

CreatureType_Head_correctspelledword_SkinTone.png
CreatureType_Head_correctspelledword_SkinTone2.png
CreatureType_Head_correctspelledword_SkinTone3.png

my text file looks like this

CreatureType_Head_wrongspelledword_SkinTone.png|CreatureType_Head_correctspelledword_SkinTone.png
CreatureType_Head_wrongspelledword_SkinTone2.png|CreatureType_Head_correctspelledword_SkinTone2.png
CreatureType_Head_wrongspelledword_SkinTone3.png|CreatureType_Head_correctspelledword_SkinTone3.png

I save it as a .txt file on my desktop, open up the file dir I want to rename in, go to File>Import Rename-Pairs.. and nothing happens.

*sigh* Please help me to understand what I am doing wrong.

Thank-you for your patience and understanding.
ErynLyn
ErynLyn
 
Posts: 5
Joined: Fri Jan 10, 2014 7:51 pm

Re: Help with Expression that will Replace part of File name

Postby ErynLyn » Sat Jan 11, 2014 2:21 am

interesting... i shut down BUL and restarted it.. tried again and now it works..
ErynLyn
 
Posts: 5
Joined: Fri Jan 10, 2014 7:51 pm


Return to Regular Expressions