Multi rename, remove last characters

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
LarsSandberg
Junior Member
Junior Member
Posts: 62
Joined: 2003-04-11, 07:46 UTC
Location: Denmark

Multi rename, remove last characters

Post by *LarsSandberg »

Hi, i'm using TC 6.02, and haven't figured out how to remove the last 13 characters during multi-rename of the names below:

DFT90S4_031217170142.sat
R47DT90s4_031027154806.sat
R47DT90s4_031027155258.sat
R47DT90s4_031027155540.sat
SHF37dt80k4_031217151945.sat

The part of the name starting with "_" and the rest, that means the last 13 characters (which is an irrelevant timestamp), I often have to remove. As I see the Range option doesn't have any solution for that.
I often need to do this kind of rename, so I hope for a solution

regards Lars
Best regards
Lars
User avatar
djk
Power Member
Power Member
Posts: 1651
Joined: 2003-03-17, 11:33 UTC
Location: Poland
Contact:

Post by *djk »

Try to check RegEx and put into:
"Search for:" box - (.*?)_(.*?)\.(.*)
"Replacew with:" box - $1.$3

File name: [N]
Extension: [E]
Last edited by djk on 2004-09-10, 10:08 UTC, edited 1 time in total.
DJK
Totally addicted to Total Commander
totalcmd.pl
en.totalcmd.pl
User avatar
Lefteous
Power Member
Power Member
Posts: 9537
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2LarsSandberg
Here is another solution without using RegEx:
Insert for filename [N-256-14]
Raymond
Senior Member
Senior Member
Posts: 454
Joined: 2003-02-08, 15:43 UTC

Post by *Raymond »

If there're some files like this:
a_a.dat
b_bb.dat
c_ccc.dat
....
It means the length of strings after '_' are not the same.
Then how can I remove strings starting with '_' to the end?
User avatar
djk
Power Member
Power Member
Posts: 1651
Joined: 2003-03-17, 11:33 UTC
Location: Poland
Contact:

Post by *djk »

2Raymond

Just like I've described above.

Copying the expressions from my post be careful to NOT copy spaces at the end of the expressions.
It should be eg. "(.*?)_(.*?)\.(.*)" and not "(.*?)_(.*?)\.(.*) "
DJK
Totally addicted to Total Commander
totalcmd.pl
en.totalcmd.pl
Raymond
Senior Member
Senior Member
Posts: 454
Joined: 2003-02-08, 15:43 UTC

Post by *Raymond »

Thank you, djk! It works.
May I ask another qeustion?
Sometimes I want the result of renaming be in this way (according to the example above):
a_a.txt
bb_b.txt
ccc_c.txt
The last part puts to the begining. Can this be done?
User avatar
djk
Power Member
Power Member
Posts: 1651
Joined: 2003-03-17, 11:33 UTC
Location: Poland
Contact:

Post by *djk »

Put $2_$1.$3 into "Replace with:" box
DJK
Totally addicted to Total Commander
totalcmd.pl
en.totalcmd.pl
Raymond
Senior Member
Senior Member
Posts: 454
Joined: 2003-02-08, 15:43 UTC

Post by *Raymond »

Thanks again for your help, djk!
I'm thinking of squeezing some time to learn Regular expressions now.
User avatar
djk
Power Member
Power Member
Posts: 1651
Joined: 2003-03-17, 11:33 UTC
Location: Poland
Contact:

Post by *djk »

2Raymond
It's really useful sometimes. :-)

There is a nice "first steps guide" to regular expressions on forum of Poptray:
http://forum.poptray.org/viewtopic.php?t=1626
DJK
Totally addicted to Total Commander
totalcmd.pl
en.totalcmd.pl
Raymond
Senior Member
Senior Member
Posts: 454
Joined: 2003-02-08, 15:43 UTC

Post by *Raymond »

@djk
You're very helpful.:)
Learning this guide will be one thing I will do this weekend.
Have a good weekend.
User avatar
djk
Power Member
Power Member
Posts: 1651
Joined: 2003-03-17, 11:33 UTC
Location: Poland
Contact:

Post by *djk »

2Raymond

I only do what others do for me, here. I just try to help others as they help me.

It's the only way I can say 'thank you' to Christian for such a great program and to authors of tons of plugins for their great work.

Have a nice weekend, too. :-)
DJK
Totally addicted to Total Commander
totalcmd.pl
en.totalcmd.pl
LarsSandberg
Junior Member
Junior Member
Posts: 62
Joined: 2003-04-11, 07:46 UTC
Location: Denmark

Post by *LarsSandberg »

Lefteous wrote:2LarsSandberg
Here is another solution without using RegEx:
Insert for filename [N-256-14]
Hi Lefteous, that was a very good solution thanks for that.
From where did you get that idea? Or is this documented anywhere?

regards Lars
Best regards
Lars
User avatar
Lefteous
Power Member
Power Member
Posts: 9537
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2LarsSandberg
Hi,
From where did you get that idea? Or is this documented anywhere?
My idea is based on a help file example ([N-8-5]). I have adapted it for the concrete task keeping in mind that filename lengths have currently a maximum of 256 characters.
User avatar
white
Power Member
Power Member
Posts: 6018
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

Lefteous wrote:2LarsSandberg
Here is another solution without using RegEx:
Insert for filename [N-256-14]
Lefteous wrote:
From where did you get that idea? Or is this documented anywhere?
My idea is based on a help file example ([N-8-5]). I have adapted it for the concrete task keeping in mind that filename lengths have currently a maximum of 256 characters.
Somehow [N1--14] seems a better solution ;-)
User avatar
white
Power Member
Power Member
Posts: 6018
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

Moderator message

Post by ScoopyDoo split to Convert only parts of the filnames to uppercase

White (moderator)
Post Reply