Total Commander Forum Index Total Commander
Forum - Public Discussion and Support
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Really complex RegEx question :)

 
Post new topic   Reply to topic    Total Commander Forum Index -> Total Commander (English) Printable version
View previous topic :: View next topic  
Author Message
louwin
Junior Member
Junior Member


Joined: 09 Jun 2007
Posts: 63
Location: Perth, Western Australia

PostPosted: Fri Apr 13, 2012 8:27 pm    Post subject: Really complex RegEx question :) Reply with quote

I apologise if this is the wrong place to post this thread/question. Maybe I should look for a RegEx forum but there are some VERY smart people on THIS forum Very Happy

I have many folders structured thus:-

Author1
--first book title.txt
--second book title.rtf
--third book
----Title.doc
----Cover.jpg
Author2
.etc.

Is there a RegEx that will append an " - " and the Author to each book title using the Multi Rename Tool? The first 2 books are difficult enough and I suspect the third book structure is impossible?

There can be 1 to many book titles and different file types involved in each Author folder.

I also suspect that RegExs only work at one level Sad

I'll be more than happy with any solution that will save me manual effort Smile

I have about 400 authors and I have already done a couple of hundred manually

Thanks in anticipation Very Happy
_________________
They said the job couldn't be done,
With a smile on his face he tackled the job
That they said couldn't be done
And he couldn't do it!
Back to top
View user's profile Send private message Send e-mail
louwin
Junior Member
Junior Member


Joined: 09 Jun 2007
Posts: 63
Location: Perth, Western Australia

PostPosted: Fri Apr 13, 2012 8:30 pm    Post subject: Reply with quote

If not possible with RegEx I would be also be grateful for a "Batch" file solution Smile
_________________
They said the job couldn't be done,
With a smile on his face he tackled the job
That they said couldn't be done
And he couldn't do it!
Back to top
View user's profile Send private message Send e-mail
MVV
Power Member
Power Member


Joined: 03 Aug 2008
Posts: 4534
Location: Russian Federation

PostPosted: Sat Apr 14, 2012 10:03 am    Post subject: Reply with quote

You don't ever need RegEx to do such thing. Very Happy

1. Press Ctrl+B to see all files in all author's folders.
2. Select all files and press Ctrl+M.
3. Enter name template [P] - [N] (or [N] - [P] in order to append author name after book name) and extension template [E]
4. All other parameters should be in default state (no search/replace, no case change etc).

BTW you can press F1 in MRT window and read about all supported parameters like [P]. And, you've selected right subforum.
_________________
VirtualPanel plugin: Temporary panel for TC (forum)
TOTALCMD.NET: TCFS2, NTLinks, CopyTree, AskParam, ConPaste, Sudo…
Back to top
View user's profile Send private message Send e-mail
louwin
Junior Member
Junior Member


Joined: 09 Jun 2007
Posts: 63
Location: Perth, Western Australia

PostPosted: Sat Apr 14, 2012 7:03 pm    Post subject: Reply with quote

******* hell! (please insert expletive in place of *******) Very Happy

What an unbeleiveable solution (and ssssooooo easy). Smile Very Happy Surprised Laughing

I didn't believe it while I read it! Rolling Eyes

Tried it and it works ******* perfectly!

I got a reply (by email) from White which detailed a brilliant RegEx solution but this one takes the cake!!!! Very Happy

THANK YOU

I wish I had asked this question 200 manually renamed Authors ago Rolling Eyes

I have dome about 1200 filenames painfully manually Sad
_________________
They said the job couldn't be done,
With a smile on his face he tackled the job
That they said couldn't be done
And he couldn't do it!
Back to top
View user's profile Send private message Send e-mail
louwin
Junior Member
Junior Member


Joined: 09 Jun 2007
Posts: 63
Location: Perth, Western Australia

PostPosted: Sun Apr 15, 2012 7:16 am    Post subject: Reply with quote

A few hours later and I'm still blown away by MVV's solution Very Happy

I read the MRT Help and included "Series" in my renames with a

[P], [N] - [G] Very Happy Very Happy Very Happy Fabulous!

So I tried to further refine my requirement.

I did a ctrl + B to "explode" and ctrl + A to "select all". Then I did a Unselect Group "*.jpg" and a Unselect Group "*.gif" as I didn't want to rename the picture files.

I then wanted to Unselect all files with a pre-existing "space-dash-space" in their filenames. I tried Unselect Group * - *.* and *" - "*.* but they just unselected ALL the files Sad

How do I Unselect all the files with a pre-existing "space-dash-space" in them? Question Embarassed
_________________
They said the job couldn't be done,
With a smile on his face he tackled the job
That they said couldn't be done
And he couldn't do it!
Back to top
View user's profile Send private message Send e-mail
ehab
Senior Member
Senior Member


Joined: 29 Oct 2007
Posts: 267
Location: Libya

PostPosted: Sun Apr 15, 2012 7:18 am    Post subject: Reply with quote

true, MVV does magic.
_________________
#181344 Personal licence
Back to top
View user's profile Send private message
mhe
Junior Member
Junior Member


Joined: 16 Feb 2003
Posts: 60

PostPosted: Sun Apr 15, 2012 8:24 am    Post subject: Reply with quote

Try unselect group, define, write " - " in the search (with the quotes) save, use what you just saved with unselect group.
Not entirely sure if it works, just tried quickly but think it does what you need.
Back to top
View user's profile Send private message
MVV
Power Member
Power Member


Joined: 03 Aug 2008
Posts: 4534
Location: Russian Federation

PostPosted: Sun Apr 15, 2012 9:22 am    Post subject: Reply with quote

louwin, try to unselect "* - *" - you need to use quotes if your mask contains a space (or TC may think that you've specified multiple masks divided by a space).
_________________
VirtualPanel plugin: Temporary panel for TC (forum)
TOTALCMD.NET: TCFS2, NTLinks, CopyTree, AskParam, ConPaste, Sudo…
Back to top
View user's profile Send private message Send e-mail
louwin
Junior Member
Junior Member


Joined: 09 Jun 2007
Posts: 63
Location: Perth, Western Australia

PostPosted: Sun Apr 15, 2012 9:44 am    Post subject: Reply with quote

Brilliant.

Thanks MVV and mhe

Now I can refine my file selection before the final rename Very Happy
_________________
They said the job couldn't be done,
With a smile on his face he tackled the job
That they said couldn't be done
And he couldn't do it!
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Total Commander Forum Index -> Total Commander (English) All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Impressum: This site is maintained by Ghisler Software GmbH

Using phpBB © 2001-2005 phpBB Group