cancel
Showing results for 
Search instead for 
Did you mean: 

rename file

AnthonyB
Occasional Advisor

rename file

I have a few thousand txt files that I need to rename.
The third line in each text file is a line with some text and/or numbers in brackets.
i.e (D182-400-654)
Is there anyway of interrogating a text file and renaming the file using the text in this line as the filename, but without the brackets?
4 REPLIES
Massimo Bianchi
Honored Contributor

Re: rename file

Hi,
you should build a script, using the findstr command.

otherway you can download grep and awk for windows a build a script with them (i'm unix minded !)

HTH,
Massimo
Jim Mallett
Honored Contributor

Re: rename file

I'm with Massimo on this one. I think a Unix utility would work more efficiently. You could poke around http://www.cygwin.com/ and see if you're interested in that route or if you want to stick with the Windows route findstr will work.
Try a findstr /? for more info.

Jim
Hindsight is 20/20
Jim Mallett
Honored Contributor

Re: rename file

I'm with Massimo on this one. I think a Unix utility would work more efficiently. You could poke around http://www.cygwin.com/ and see if you're interested in that route or if you want to stick with the Windows route findstr will work.
Try a findstr /? for more info.

Jim
Hindsight is 20/20
Jim Mallett
Honored Contributor

Re: rename file

(sorry about the double post above, i tried to pull it back before i submitted it)

What might work even better, but there is more of a learning curve is a simple basic program like QBasic. You could even try to find a freebee visual basic around.

Jim
Hindsight is 20/20