Anomaly when renaming file name, which contains square brackets


#1

Is there an anomaly when you rename the file name and, presumably, the file name contains square brackets?

Example:

The file name is ...
A.B.C.[D].mp3

... and should be changed to ...
A - B - C.mp3

Execute the following group of actions ...

Begin Action Group TEST_1

Action #1
Actiontype 5: Format value
Field ______: F
Formatstring: %_filename%

Action #2
Actiontype 2: Replace
Field ______: _FILENAME
Original ___: .
Replace with: ÷

[_] Only as whole word [_] Case sensitive comparison

Action #3
Actiontype 2: Replace
Field ______: F
Original ___: .
Replace with: ÷

[_] Only as whole word [_] Case sensitive comparison

Action #4
Actiontype 4: Replace with regular expression
Field ______________: F
Regular expression _: ^(.+?)\s(.+?)\s(.+?)\s[.+?]$
Replace matches with: $1÷-÷$2÷-÷$3

[_] Case sensitive comparison

Action #5
Actiontype 4: Replace with regular expression
Field ______________: _FILENAME
Regular expression _: ^(.+?)\s(.+?)\s(.+?)\s[.+?]$
Replace matches with: $1÷-÷$2÷-÷$3

[_] Case sensitive comparison

Note: Replace each special ÷ character with one space character.
End Action Group TEST_1 (5 Actions)

The result is:

Field F has the content ...
A - B - C

... and the file name is ...
A B C [D].mp3

... maybe because the pseudo tag-field _FILENAME is only written once at end of the action group, that means the physical renaming of the accessed file ...
... maybe the square brackets have nothing to do with the effect?

There are workarounds to change the file name from "A.B.C.[D].mp3" to "A - B - C.mp3" ...

Workaround 1.

Begin Action Group TEST_2

Action #1
Actiontype 5: Format value
Field ______: F
Formatstring: %_filename%

Action #2
Actiontype 2: Replace
Field ______: F
Original ___: .
Replace with: ÷

[_] Only as whole word [_] Case sensitive comparison

Action #3
Actiontype 4: Replace with regular expression
Field ______________: F
Regular expression _: ^(.+?)\s(.+?)\s(.+?)\s[.+?]$
Replace matches with: $1÷-÷$2÷-÷$3

[_] Case sensitive comparison

Action #4
Actiontype 5: Format value
Field ______: _FILENAME
Formatstring: %F%

Action #5
Actiontype 9: Remove fields
Fields to remove (semicolon separated): F

Note: Replace each special ÷ character with one space character.
End Action Group TEST_2 (5 Actions)

Workaround 2.

Begin Action Group TEST_3

Action #1
Actiontype 2: Replace
Field ______: _FILENAME
Original ___: .
Replace with: ÷

[_] Only as whole word [_] Case sensitive comparison

Action #2
Actiontype 5: Format value
Field ______: _FILENAME
Formatstring: $regexp(%_filename%,'^(.+?)\s(.+?)\s(.+?)\s[.+?]$','$1÷-÷$2÷-÷$3')

Note: Replace each special ÷ character with one space character.
End Action Group TEST_3 (2 Actions)

Workaround 3.

Begin Action Group TEST_4

Action #1
Actiontype 5: Format value
Field ______: _FILENAME
Formatstring: $regexp($replace(%_filename%,'.','÷'),'^(.+?)\s(.+?)\s(.+?)\s[.+?]$','$1÷-÷$2÷-÷$3')

Note: Replace each special ÷ character with one space character.
End Action Group TEST_4 (1 Action)

Workaround 4.

Begin Action Group TEST_5

Action #1
Actiontype 5: Format value
Field ______: _FILENAME
Formatstring: $regexp(%_filename%,'^(.+?).(.+?).(.+?).[.+?]$','$1÷-÷$2÷-÷$3')

Note: Replace each special ÷ character with one space character.
End Action Group TEST_5 (1 Action)

DD.20111127.1022.CET
DD.20140320.1355.CET