Rename txt file from its content

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Rename txt file from its content

Postby Suppo » Sun Feb 09, 2014 12:51 am

hello

im having a problem here (lack of knowledge)
i have txt files that are named badly and id like to rename them with their own content
more specifically : every txt file line 2 is what i want to use as title
is this possible to achieve with some expressions?
Suppo
 
Posts: 1
Joined: Sun Feb 09, 2014 12:47 am

Re: Rename txt file from its content

Postby truth » Sun Feb 09, 2014 11:26 am

BRU wont read the content of files to be renamed.
With sed, you could use something like:

For %a in (*.txt) do @sed -n "2s/.*/ren %a &.txt/p;3q" %a|sed e
The .* matches all of Line2 as NewName with no error-checking!
Renames against pre-existing same-named files, or with illegal chars, etc, would fail.

You could certainly code all this in, but most prefer using graphical apps.
Den4b-Renamer seems to be popular for such things, but I've yet to try it.
I do know it has the ability to file-read for rename-criteria, but beyond that, I've no idea.
truth
 
Posts: 221
Joined: Tue Jun 25, 2013 3:39 am
Location: Earth, OrionArm, MilkyWay


Return to BRU Support