Rename files using substrings of directory.

Advanced Renamer forum
#1 : 19/02-13 19:37
Henrique Gornic
Henrique Gornic
Posts: 4
Files names are:

\cd1 - nona\1
\cd1 - nona\2
\cd1 - nona\3

Would like to have files name renamed to:

\cd1 - nona\cd1 - 1
\cd1 - nona\cd1 - 2
\cd1 - nona\cd1 - 3

New File name would be 6 character substring of dir + actual file name

Help please.

Thank you

Henrique


19/02-13 19:37
#2 : 20/02-13 11:13
Stefan
Stefan
Posts: 264
Reply to #1:

FROM:
\cd1 - nona\1
\cd1 - nona\2
\cd1 - nona\3
TO:
\cd1 - nona\cd1 - 1
\cd1 - nona\cd1 - 2
\cd1 - nona\cd1 - 3
New File name would be 6 character substring of dir + actual file name




My first try would be to do it like this (maybe there is an shorter way?):

"\cd1 - nona\1"

1.) - add dir name as new name, see
http://www.advancedrenamer.com/user_guide/metho d_add
http://www.advancedrenamer.com/user_guide/tags
http://www.advancedrenamer.com/user_guide/tags_ default
<DirName:X> Inserts the last directory name. eg. "c:\windows\notepad.exe" will give "windows" as result.

"\cd1 - nona\cd1 - nona"


2.) - modify that new name by removing from 6 till the end:
http://www.advancedrenamer.com/user_guide/metho d_remove

"\cd1 - nona\cd1 - "


3.) - add original file name again to the end:
http://www.advancedrenamer.com/user_guide/metho d_add
<Name> Inserts the original name of the file. Not the path and not the extension, only the name

"\cd1 - nona\cd1 - 1"




So you would use three rules/methods:
[methods]
method0000=methodname:"newname"; mask:"<DirName:1> "; applyto:"name";
method0001=methodname:"remove"; start:"8"; count:"255"; applyto:"name";
method0002=methodname:"add"; position:"1"; add:" <Name>"; backwards:"1"; applyto:"name";


BTW,
i don't know why i have to start from "8", but that worked for me to get "6" signs from my dir name??!?
And, my count "255" is just a any number to reach the end of the dir name. "20" would do too, but just in case...

HTH?

----------
If this tool had saved you time, perhaps you want to donate an Dollar to Kim?
See http://www.advancedrenamer.com/download >>> [Donate] button.


20/02-13 11:13
#3 : 20/02-13 12:56
Henrique Gornic
Henrique Gornic
Posts: 4
Reply to #2:

I tested your suggstion and worked fine but there are many files in many dir to rename.

I need to rename all my classics colletion to play in a small mp3 device and all files must be in the same dir

Only Bach has more than 170 dirs each with 12 files in average

I was looking for a way to refine the "new name method"

<DirName:1> - <Name>.<Ext>

just selecting some characters of

<DirName:1>

I use now the complete dir name and end with repetitive names like

Bach 2000 v06CD02 (Mass in Bm BWV 232) - 04-Mass in Bm,BWV 232[Symbolum Nicenum Credo]-Et incarnatus est.mp3.

All i need would be

Bach v06CD02 - 04-Mass in Bm,BWV 232[Symbolum Nicenum Credo]-Et incarnatus est.mp3.

Thank you anyway.

Henrique


20/02-13 12:56
#4 : 20/02-13 13:31
Stefan
Stefan
Posts: 264
Reply to #3:

To make this automatic, you have to tell the machine where to split every dir name.

On example
"Bach 2000 v06CD02 (Mass in Bm BWV 232)",...

can you say to
always split after a string like " "CD", followed by two digits"

or always split right before the first open , left parenthesis?


You have to find an common pattern, so the program knows where to split.
Then you can use RegularExpressions Rule/Method to split all dir names into wanted parts.



Perhaps this method can aid:

http://www.advancedrenamer.com/user_guide/tags_ default
<Word:X> Will insert a word from the filename index by X.
<Word:3> will insert the third word of the filename.

So you can take always three words from the dir name:
1. add dir name
2. take first three words only
3. add file name

[methods]
method0000=methodname:"newname"; mask:"<DirName:1>"; applyto:"name";
method0001=methodname:"newname"; mask:"<word:1> <word:2> <word:3>"; applyto:"name";
method0002=methodname:"add"; add:" # <Name>"; position:"1"; backwards:"1"; applyto:"name";

The " # " part is only for clarifying on testing.


@Kim:
for me (Aren 3.52) always the last sign is dropped from last <word:3> part. Bug?

----------
If this tool had saved you time, perhaps you want to donate an Dollar to Kim?
See http://www.advancedrenamer.com/download >>> [Donate] button.


20/02-13 13:31
#5 : 20/02-13 14:19
Henrique Gornic
Henrique Gornic
Posts: 4
Reply to #4:

Did not understand how to use the 3 methods you listed. Can you explain it better?


Does the program have a comand similar to substr to deal with dir names, instead of file names?


<Substr
:POS:COUNT:START> Will insert a part of the original filename into the new name. The POS and COUNT parameters are used to define what part of the filename that will get copyed.


Using such comand with the new name method below would do the job in one line:

<DirName:1> - <Name>.<Ext>

All i need is to insert in the new file name 5 characters after char number 6 from dir name, from left to right ...for instance.


20/02-13 14:19
#6 : 20/02-13 15:49
Stefan
Stefan
Posts: 264
Reply to #5:

>>Did not understand how to use the 3 methods you listed. Can you explain it better?

[methods]
method0000=methodname:"newname"; mask:"<DirName:1>"; applyto:"name";
method0001=methodname:"newname"; mask:"<word:1> <word:2> <word:3>"; applyto:"name";
method0002=methodname:"add"; add:" # <Name>"; position:"1"; backwards:"1"; applyto:"name";

means
- Add NewName method and insert "<DirName:1>"
- Add NewName method and insert "<word:1> <word:2> <word:3>"
- Add Add method and insert "<Name>", At Index 1, check backwards check box.


This can even shorten too
- Add NewName method and insert "<DirName:1>"
- Add NewName method and insert "<word:1> <word:2> <word:3> <Name>"



------------------

>>>Does the program have a comand similar to substr to deal with dir names, instead of file names?

I don't know. But in two steps by adding the dir name as name first, it works anyway. Isn't it?


------------------

>>>All i need is to insert in the new file name 5 characters after char number 6 from dir name,

That i have show you an post more above and you answered that this doesn't fit for all dir names.
1.) - add dir name as new name
2.) - modify that new name by removing
3.) - add original file name

Or changes are i don't get you.

----------
If this tool had saved you time, perhaps you want to donate an Dollar to Kim?
See http://www.advancedrenamer.com/download >>> [Donate] button.


20/02-13 15:49
#7 : 20/02-13 16:45
Henrique Gornic
Henrique Gornic
Posts: 4
Reply to #6:

Sorry

i am a new user.

Did not know i can chain 2 or more methods at the same time.

I was appliyng one method each time.

Problem is solved.

Thank you


20/02-13 16:45
#8 : 20/02-13 19:33
Stefan
Stefan
Posts: 264
Reply to #7:

>>>Problem is solved.
Great! Thanks for feedback.



>>>Did not know i can chain 2 or more methods at the same time.
>>>I was appliyng one method each time.

Confirmed that fact is missed from user guide
>http://www.advancedrenamer.com/user_guide/getti ngstarted

Only from an example you can guess that you can do such things
>http://www.advancedrenamer.com/user_guide/examp le_downloaded




.

----------
If this tool had saved you time, perhaps you want to donate an Dollar to Kim?
See http://www.advancedrenamer.com/download >>> [Donate] button.


20/02-13 19:33