file rename help - add text within brackets

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
idealcrash
Junior Member
Junior Member
Posts: 2
Joined: 2012-10-05, 15:24 UTC

file rename help - add text within brackets

Post by *idealcrash »

Hi!

Sorry for what might be a trivial question, but I've been struggling with this for hours. I have a series of audio files of the following type:

20120804 192127 thaw (acoustic take 1).m4a

The first 8 digits are the date, then the time (unimportant), and then the title.

I'd like to know if there is an algorithm to insert the first 8 digits (ie the date) within the bracket, like this:

20120804 192127 thaw (20120804 acoustic take 1).m4a

Ideally this would be done in search/replace by searching for "(" and replacing it with "([N1-8]" but that doesn't work, or at least I haven't found a way to make it work.

If anyone could help it would be much appreciated. Thanks!
Sob
Power Member
Power Member
Posts: 945
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

Regular expressions can help. Search for:

Code: Select all

^(\d{8})([^\(]+)\(
Replace with:

Code: Select all

$1$2($1 
And don't forget to check RegEx.
User avatar
nsp
Power Member
Power Member
Posts: 1956
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: file rename help - add text within brackets

Post by *nsp »

idealcrash wrote:Hi!

Sorry for what might be a trivial question, but I've been struggling with this for hours. I have a series of audio files of the following type:

20120804 192127 thaw (acoustic take 1).m4a

The first 8 digits are the date, then the time (unimportant), and then the title.

I'd like to know if there is an algorithm to insert the first 8 digits (ie the date) within the bracket, like this:

20120804 192127 thaw (20120804 acoustic take 1).m4a

Ideally this would be done in search/replace by searching for "(" and replacing it with "([N1-8]" but that doesn't work, or at least I haven't found a way to make it work.

If anyone could help it would be much appreciated. Thanks!
Use regex Expression:

Code: Select all

Search for :^((\d{8})\s\d{6})([^\(]+)\((.*)\)$
Replace with: $1$3($2 $4)
tick RegEx
Verify that [E] is not selected
That should do it.
$1 is date + Time
$2 is Date
$3 is title
$4 is album or whatever inside ()
--Edited Sob was faster ;)--
idealcrash
Junior Member
Junior Member
Posts: 2
Joined: 2012-10-05, 15:24 UTC

Post by *idealcrash »

Thank you so much Sob and nsp! Both these methods do the job, thanks for your time!
Post Reply