Syntax for batch rename please ?

Chitchat about x² / 2X products

Moderators: fgagnon, nikos, Site Mods

Post Reply
dunno
Gold Member
Gold Member
Posts: 442
Joined: 2007 Nov 18, 03:00
Location: Tropical Hammock

Syntax for batch rename please ?

Post by dunno » 2015 Sep 15, 10:25

Files are named,
101 - abs
104 - def
301 - ghi
etc..

Rename them to,
1 - abs
2 - def
3 - ghi
etc.

Many thanks.

Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: Syntax for batch rename please ?

Post by Kilmatead » 2015 Sep 15, 16:47

Assuming that all the files you want to rename are actually prefixed with a 3-digit number, just put:

$01$[4:256]

into the field and check the preview. It will whine and complain about the template containing illegal characters when you hit the rename button (and that the world will come to an end), but you can ignore that and just blame Nikos' inability to test things properly. :shrug:

This will actually rename them with a leading-zero on the new numbers (to protect sorting-order), if you really do want single-digits (not wise), then change $01 to $1

If your original files do not have a constant of 3-digit prefix, then this method best be applied with speculative care and watered-down whiskey (or, in your case, rum).

bugman
New Member
Posts: 1
Joined: 2015 Sep 15, 19:41

Re: Syntax for batch rename please ?

Post by bugman » 2015 Sep 15, 20:14

in my endeavor to find a solution for your challenge I figured out how to reliably crash x2. 8)
if you like to try it out you yourself create two files "001 - abc.txt" & "001 - dfg.txt"
then in Mass rename wizard select Mode "Match and replace part"
In "What to match:" text box add "$B$[3:2] and in "Target name template:" "test$01".
Et Voila!

greetings
bugman

dunno
Gold Member
Gold Member
Posts: 442
Joined: 2007 Nov 18, 03:00
Location: Tropical Hammock

Re: Syntax for batch rename please ?

Post by dunno » 2015 Sep 16, 04:00

Kilmatead wrote:$01$[4:256]
Perfect thanks, leading zero is what I had in mind.

Kilmatead wrote:and watered-down whiskey (or, in your case, rum).
May favourite is Rum with fresh pineapple juice + twist of fresh lemon juice, A Tropical poor man's 'Mojito', which is nothing more than sugar to kill the taste of cheap rum and le'mon juice to cloud it up, add some sprigs of mint to make it look pretty and expensive, and the girls luv it, Men take note - mint is a breath freshner, chew this before attempting to swap spit, two birds with one stone, what's not to like.

a new problem please kind sirs, files named,
S01E02.Send.In.The.Clones
S01E03.Sphinx.For.The.Memories
S01E04.Where.No.Duck.Has.Gone.Before < (possible to remove the full stops ?).

is there any way of beautifying that to,
S01E02 - Send In The Clones or
01 - Send In The Clones

I thank you all for your time.

User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1162
Joined: 2005 Oct 16, 19:09

Re: Syntax for batch rename please ?

Post by FrizzleFry » 2015 Sep 16, 04:30

first use match and replace part to deal with the first dot
what to match:.
target: -

then use search and multi-replace to handle the other dots
what to match:.
target: (space)

dunno
Gold Member
Gold Member
Posts: 442
Joined: 2007 Nov 18, 03:00
Location: Tropical Hammock

Re: Syntax for batch rename please ?

Post by dunno » 2015 Sep 16, 05:04

Ok I got it to work by removing the $B

thanks

pj
Gold Member
Gold Member
Posts: 402
Joined: 2006 Jan 26, 14:01
Location: Florida

Re: Syntax for batch rename please ?

Post by pj » 2015 Sep 16, 19:28

Although no longer supported (despite impassioned and pleading emails) and being somewhat "challenged" on 64-bit Windows, I still use awxRename for this type of quick-and-dirty name fixes.

The native options to change "." to " ", UPPERCASE, lowercase, and Title Case among other things is more convenient than mass rename.

(I'm still VERY HAPPY Nikos choose to add the enhancement to the mass rename option! :beer: )

AwxRename works fine on 32-bit, but on 64-bit, just ignore the extra "lowercase" menu option and all the other options are "up one" on the menu. Kind of wonky but not too bad once you get used to it.

-------------------------------
PJ in FL

User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1162
Joined: 2005 Oct 16, 19:09

Re: Syntax for batch rename please ?

Post by FrizzleFry » 2015 Sep 16, 20:48

Are you using the 64-bit version of awxRename?

I have not noticed any "wonky" behavior of awxRename on 64-bit Windows 7, 8, 8.1 or 10. I have adjusted the right-click menu to add many common renaming patterns.

pj
Gold Member
Gold Member
Posts: 402
Joined: 2006 Jan 26, 14:01
Location: Florida

Re: Syntax for batch rename please ?

Post by pj » 2015 Sep 17, 12:32

I'd be very interested how you got awxRename to work, especially modification of the context menu.

I have awxRename installed on 64-bit Win 7 HPE and 32-bit Win 7 Pro, and in both installations I cannot adjust the context menu. There is a duplicate "lowercase" entry. All the menu entries below the 2nd "lowercase" entry are actually run by clicking the entry above it.

I've reinstalled multiple times, wiped out all registry references in case something was lingering, but still have this issue. It's small, fast and convenient so I just put up with the anomalies and use the items already on the menu or the Advanced option.

---------------------------------
PJ in (rainy) FL

User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1162
Joined: 2005 Oct 16, 19:09

Re: Syntax for batch rename please ?

Post by FrizzleFry » 2015 Sep 17, 13:17

awxRename has a menu editor that you can access from the right-click menu or you can edit the awxRename.ini file directly... you probably need to install awxRename to a location that does not require admin privilege to write to since it is not aware of UAC... you could try running the awxRename menu editor from an admin x2...

the format of the awxRename.ini is fairly simple...

there is a menu section that lists all the menu entries

[Menu]
lowercase=
lowercase extension=
UPPERCASE=
Mixed Case=
Title Case=
StripSpaces=
...

and then each menu entry has a section

[lowercase]
Command=use locale;$file =lc($file);
Bitmap=D:\tools\awxRename\Bitmaps\lcase.bmp
IgnoreExtension=0

[lowercase extension]
Command=use locale;$file =~s/(.*\.)([^.]*)$/$1\L$2/;
Bitmap=
IgnoreExtension=0

[UPPERCASE]
Command=use locale;$file =uc($file);
Bitmap=
IgnoreExtension=0

[Mixed Case]
Command=use locale;$file =~s/([\w']+)/\u\L$1/g;
Bitmap=
IgnoreExtension=1

[StripSpaces]
Command=$file =~s/ //g;
Bitmap=
IgnoreExtension=0

Post Reply