Page 1 of 1

Can I rename a file to the contents of the first line?

Posted: Sun Sep 23, 2007 3:10 am
by digitalmonkeyman
The text of the first line is what I would like to rename the file to.

Is this program capable of that?

Thank You

Re: Can I rename a file to the contents of the first line?

Posted: Tue Oct 09, 2007 9:35 pm
by Abacre
Yes. It's possible with Advanced Find and Replace.

For example you have the file with the following text in it:

Code: Select all

hello.txt
hello world
this is the test
the end of file
Go to main menu - Action - Options - Batch Replace
check "Include File Name Into Search Scope"
check "Rename File Name if it was changed"
check "Modifier S"

Go to Batch replace tab, check on "Use regular expressions".
Put into the grid, search for:
.*\r\n(.*)\r\n

Replace with:
$1\r\n$1\r\n

That's all I verified it works perfectly.