Rename txt files using the frst line of the content as name

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

Rename txt files using the frst line of the content as name

Postby Farhad Jan » Tue Aug 22, 2017 5:23 am

Hi there,
I have thousands of files that i need to rename. They are in .txt format. I want the first line of the content of the file as title of the txt file. Plz help

Example: I have poems in text (.txt) files but names are not correct. I want the first line of the content as the title of the txt files.
Plz let me know. Thanks in advance......
Farhad Jan
 
Posts: 1
Joined: Tue Aug 22, 2017 5:10 am

Re: Rename txt files using the frst line of the content as name

Postby Admin » Tue Aug 22, 2017 5:42 am

Hi, it is not possible with BRU as BRU cannot open the file and check for its content. I think you will need to create and use Powershell script for that.
Admin
Site Admin
 
Posts: 1464
Joined: Tue Mar 08, 2005 8:39 pm

Re: Rename txt files using the frst line of the content as name

Postby therube » Tue Aug 22, 2017 4:13 pm

pseudo-code


Code: Select all
dir /b     file* > xxx
head -1 -q file* > yyy
paste  xxx yyy  "-d|"  >  zzz


Then use apply strings from an external file to my new file names


CoreUtils for Windows
therube
 
Posts: 313
Joined: Mon Jan 18, 2016 6:23 pm


Return to BRU Support