You are not logged in.
Pages: 1
There are a files:
-----------------------------------
01 - Bad Attitude(2).mp3
01 - Bad Attitude.mp3
02 - The Unwritten Law(2).mp3
02 - The Unwritten Law.mp3
03 - Call Of The Wild(2).mp3
03 - Call Of The Wild.mp3
04 - Mad Dog(2).mp3
04 - Mad Dog.mp3
...
and so on
-----------------------------------
How to rename dublicate files
from: 01-file-name(2).mp3
to: _01-file-name(2).mp3
So I have to localize dublicate files to the list
-----------------------------------
_01 - Bad Attitude(2).mp3
_02 - The Unwritten Law(2).mp3
_03 - Call Of The Wild(2).mp3
_04 - Mad Dog(2).mp3
01 - Bad Attitude.mp3
02 - The Unwritten Law.mp3
03 - Call Of The Wild.mp3
04 - Mad Dog.mp3
-----------------------------------
Thanx.
Frost.
Russia.
Last edited by frost (2006-11-11 22:17)
Offline
Hi Frost!
Will there be cases when round brackets will occur in other parts of the filename, apart from "(2)" part?
Is it safe to assume that files that have round brackets will require a "_" prefixed to their names?
Offline
When I copy many files from one folder to another, Total Commander automaticly renames dublicate files to view:
name_file(2).mp3 (or *(2).doc, *(2).jpg, *(2).mpg and so on...).
The dublicate name (in Total Commander) always have (2).
I want separate files by the name and delete them, but Total Commander couldn't make it.
I need rename files from view *(2).* to any prefix before the name, like
1*.*
-*.*
a*.*
It doesn't matter what character before the name.
It could be any character. But renames only files with (2) suffix.
Frost.
Russia.
Offline
Here you go... below is the pascal script that will do that
It will put PREFIX to filenames that end with SUFFIX, you can change them to whatever you wish!
const
PREFIX = '_';
SUFFIX = '(2)';
var
Pos: Integer;
Name, S: WideString;
begin
Name := WideExtractBaseName(FileName);
Pos := WideLength(Name) - Length(SUFFIX) + 1;
if Pos > 0 then
begin
S := WideCopy(Name, Pos, Length(SUFFIX));
if S = SUFFIX then
FileName := PREFIX + FileName;
end;
end.
And here is the screenshot for your examples:
Offline
I have no words !!!!
It's work !!!
Respect to you, Denis.
I will never solve the problem without you.
Great program.
Thanx a lot.
I think thread must be closed.
Thanks again.
----------------------------------------
Frost, Russia.
Offline
Pages: 1