#1 2010-08-21 17:40

gnzL
Member
Registered: 2010-08-21
Posts: 4

Work only over numbers in alphanumeric filename

Hello, I have the following question ...

Days ago I was working with thousands of files named with the following format:

1232343453-456464-567578-78978979 - sample file

Many of these files are poorly named because it does not meet the required format. Some of them have unnecessary spaces and dashes in the wrong position. I need to correct thousands of files and would be easier if it were possible to apply the rules only on the numeric part of the file name, omitting the letters.

It is possible to work on a specific part of the file name?

thanks from Chile.

Offline

#2 2010-08-21 19:40

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Work only over numbers in alphanumeric filename

gnzL wrote:

It is possible to work on a specific part of the file name?

I think Yes, but it depends on what you wanna do.

And at least you can use PascalScript to split the file name into parts (e.g. into first part with numbers till an dash, then the rest as part 2).
Then you can work in PascalScript with this first part only and at the end you can glue the last part again to build your wanted file name.

See here for such an kind of an script (not for your issue, but you may see what i talk about)>> http://www.den4b.com/forum/viewtopic.php?pid=4876#p4876

- - -

There you find an link too for an work around to split an file name into base and extension at an wanted position >> http://www.den4b.com/forum/viewtopic.php?pid=1484#p1484
If this would work for you you can say "all till last dash is file name only, and the rest is the extension"
"1232343453-456464-567578-78978979.sample file#ext"
Maybe this works for you.


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#3 2010-08-22 02:37

gnzL
Member
Registered: 2010-08-21
Posts: 4

Re: Work only over numbers in alphanumeric filename

Hi, I saw the example and I think meets what I want, the problem is I do not know how to handle these advanced options for this operation ...

could you tell me what to write, and where, to work on the 32 characters that are before the dash?

the format of these thousands of files is: (32 characters including dashes) - (several words.mp3)"

thanks Stefan

Offline

#4 2010-08-22 07:23

SafetyCar
Senior Member
Registered: 2008-04-28
Posts: 446
Website

Re: Work only over numbers in alphanumeric filename

I think you should give us at least 3 examples of actual names and the result you want.

Because the problem is no to split 32 chars, the problem is what you want to do with each part...


If this software has helped you, consider getting your pro version. :)

Offline

#5 2010-08-22 13:02

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Work only over numbers in alphanumeric filename

Hi gnzL.

As SafetyCar means too i would help to know what you want to manipulate on that first 32 signs, to support you better.
Maybe it's not necessary at all to use an PascalScript? But who knows? We not.



Anyway, if you want to do this on your own, you can use this example script as an start:


gnzL wrote:

could you tell me what to write, and where, to work on the 32 characters that are before the dash?

the format of these thousands of files is: (32 characters including dashes) - (several words.mp3)"

FROM:
1232343453-456464-567578-7897890 - sample file several words.ext
TO:
#1232343453-456464-567578-7897890# - sample file several words.ext
USE:
this PascalScript (For how to use an PascalScript please see our wiki >>> http://www.den4b.com/wiki/ReNamer:Rules:PascalScript)

var
 Part1, Part2: WideString;
 
begin
   // function Copy(S: String; Index, Count: Integer): String; 
   // Copies Count characters from string S, starting at position Index, 
   // and returns them as a new string. 
   Part1 := copy(FileName, 1, 32);
   Part2 := copy(FileName, 33, 255);

   //Debug MsgBox:
   //ShowMessage('Part1: ' + Part1 + #10#13 + 'Part2: ' + Part2);
    if (DialogYesNo('Part1: ' + Part1 + #10#13 + 'Part2: ' + Part2
                        + #10#13 + #10#13 + 'Continue with next file?') = False) then Exit;


   //Do something to Part1:
   Part1 := '#' + Part1 + '#'
   //see
   //http://www.den4b.com/wiki/ReNamer:Pascal_Script
   //http://www.den4b.com/wiki/ReNamer:Pascal_Script:Functions
   
   
   //Build your new file name:
   FileName := Part1 + Part2;
end.


Note: always don't trust me, test this with some test files first.


HTH? big_smile
If you need more aid, just tell us.
Happy ReNaming


EDIT: wrong counted 32 signs in example file, was one too less.

Last edited by Stefan (2010-08-22 13:09)


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#6 2010-08-22 18:57

gnzL
Member
Registered: 2010-08-21
Posts: 4

Re: Work only over numbers in alphanumeric filename

Thanks for responding, the file name that I used as example I wrote not counting characters, so the inaccuracy.

What I seek is to isolate letters, and work on numbers only. Regardless of the error in them. I will always have to remove spaces, dots and dashes leftover, so I will get the correct name of 30 characters, which is accompanied by a space, a hyphen (on site 32), a space and then an indefinite and variable amount of words .

This is a more concrete example:

062-1234 5671 234567-1-1234-08-01 - X amount of words.mp3
06-02-123456.71234567-1-1234-08-02 - X amount of words.mp3
06-2-123456712.34567-1--08-03 - X amount of words.mp3
06-2-12345671234567-1-1234.08.04 - X amount of words.mp3
06-02-1234567 1234567-1-1233-08-05 - X amount of words.mp3
052-1234 5671 234567-1-1234-08-01 - X amount of words.mp3
05-02-123456.71234567-1-1234-08-02 - X amount of words.mp3
06-2-123456712.34567-1--08-03 - X amount of words.mp3
06-2-12345671234567-1-1234.08.04 - X amount of words.mp3
06-02-1234567 1234567-1-1233-08-05 - X amount of words.mp3
062-1234 5671 234567-1-1234-08-01 - X amount of words.mp3
06-02-123456.71234567-1-1234-08-02 - X amount of words.mp3
03-2-123456712.34567-1--08-03 - X amount of words.mp3
06-2-12345671234567-1-1234.08.04 - X amount of words.mp3
06-02-1234567 1234567-1-1233-08-05 - X amount of words.mp3
062-1235 5671 234567-1-1234-08-01 - X amount of words.mp3
06-02-123556.71234567-1-1234-08-02 - X amount of words.mp3
06-2-123556712.34567-1--08-03 - X amount of words.mp3
06-2-12355671234567-1-1234.08.04 - X amount of words.mp3
06-02-1234567 1234567-1-1233-08-05 - X amount of words.mp3

Corrected names:

06212345671234567-1-1234-08-01 - X amount of words.mp3
06212345671234567-1-1234-08-02 - X amount of words.mp3
06212345671234567-1-1234-08-03 - X amount of words.mp3
06212345671234567-1-1234-08-04 - X amount of words.mp3
06212345671234567-1-1234-08-05 - X amount of words.mp3

...then 1234 could be 1267, 08 could be 09, 062 -> 043, etc, etc.
..."X amount of words" is a different chain in every file. "X amount of words.mp3" is only used as reference.

It's not as simple as:

insert-> 06212345671234567-1-1234-08
serialize-> 01-02, etc.

There are thousands of files, I have no access to pc so I can not copy names to see the real problem, it is similar but not equal to what I put as an example.

Thanks. I hope it's clearer now.

wink

Last edited by gnzL (2010-08-22 19:07)

Offline

#7 2010-08-22 20:22

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Work only over numbers in alphanumeric filename

Oh, that's looking difficult.

You have to find an common pattern to work on.

Like for:
"06-2-123556712.34567-1--08-03 - X amount of words.mp3"
"06-2-12345671234567-1-1234.08.04 - X amount of words.mp3"

PART1 = take all signs till "-1-"  ===> "06-2-123556712.34567"
PART2 = take all signs till " - " ====> "-08-03"
PART3 = the rest =============> "X amount of words.mp3"

Then remove all spaces and dashes and dots in Part1. ===> "06212355671234567"
Then in Part2 find leading dash and remove them. Also replace dots by dashes. ==> "08-03" or "1234-08-04"

Then build new FileName: PART1 + PART2 + ' - ' + PART3;


So question: can we use "-1-" and " - " as part separator?


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#8 2010-08-22 22:28

gnzL
Member
Registered: 2010-08-21
Posts: 4

Re: Work only over numbers in alphanumeric filename

Hello, I think you understood my explanation well, and at the same time, how slow it is through rules by having to review the enormous list of files.

I made this renaming operation days ago, more than 10,000 files, and that's when I realized that Renamer lacks this important option, so I came to the forum.

To achieve this, I had to make many rules, and as you indicate, I looked for patterns to replace and it worked fine, but it took me some time to review the rules.

It would be nice to have this option in the program.

For now I have no doubt, in the future I will continue to do so through rules, although it is slower.

Thanks Stefan.

Last edited by gnzL (2010-08-22 22:29)

Offline

Board footer

Powered by FluxBB