Page 1 of 1

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

PostPosted: Tue Aug 22, 2017 5:23 am
by Farhad Jan
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......

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

PostPosted: Tue Aug 22, 2017 5:42 am
by Admin
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.

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

PostPosted: Tue Aug 22, 2017 4:13 pm
by therube
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