#1 2006-07-23 03:33

dbrename
Member
Registered: 2006-07-23
Posts: 1

Delete first 2 digits

I want to delete the first 2 numbers in a filename so as to make the list of filename entries uniform.

FROM: 1978_001 - Bee Gees - Night Fever (192S - 3.31)

TO: 78_001 - Bee Gees - Night Fever (192S - 3.31)

How?

Thanks, Don

Offline

#2 2006-07-23 03:41

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,378

Re: Delete first 2 digits

Hi Don smile

If you simply want to delete first 2 character, you can use Delete rule, and set it to delete from position 1 until count 2.

But if you want to remove first 2 characters ONLY if they are digits, then you need to use this script in the PascalScript rule:

begin
  if IsWideCharDigit(WideGetChar(FileName, 1)) and
     IsWideCharDigit(WideGetChar(FileName, 2))
  then WideDelete(FileName, 1, 2);
end.

Offline

#3 2008-02-27 21:54

krtek
Senior Member
From: Łódź (Poland)
Registered: 2008-02-21
Posts: 262

Re: Delete first 2 digits

You can use a RegEx rule as well:

Expression: ^\d\d(.+)
Replace: $1

And this freedom of choice is that what makes ReNamer so wonderful and powerful tool.


Regular Expressions are not as hard to understand as you may think. Check ReNamer's manual or nice Regular Expressions tutorial for more info and start to use full power of applications that use them (like ReNamer, Mp3Tag and so on).

Offline

#4 2008-03-04 20:58

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,378

Re: Delete first 2 digits

krtek, You are resurrecting a thread which is almost 2 years old tongue

By the way, with the latest version of ReNamer, script should be as follows:

begin
  if IsWideCharDigit(FileName[1]) and
     IsWideCharDigit(FileName[2])
  then WideDelete(FileName, 1, 2);
end.

Offline

Board footer

Powered by FluxBB