topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday April 23, 2024, 12:46 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Rename text file based on contents  (Read 2667 times)

daddydave

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 867
  • test
    • View Profile
    • Donate to Member
Rename text file based on contents
« on: October 09, 2010, 05:06 PM »
I have about 100 files I would like to rename based on the contents of the first line. For example, if I have a file File_23.txt and the first line is HG.ColorCodes.UndergroundCables, then I want the file to be renamed HG.ColorCodes.UndergroundCables.txt. When I Google this, what I find are ways to do this from a batch file, or from awk, or from VBScript. I can do that myself, but because of all the competition between file renamers, I would think there would be a way to do it from a GUI somehow. I am not seeing it in BRU or RenameMaster, though. BRU can read from a text file but you have to hardcode the new name for each file in that text file, so that is not what I want. Maybe there is something I missed?

EDIT: A cursory glance at the web site suggests Pfrank may be able to do it, I will let you know,
« Last Edit: October 09, 2010, 05:12 PM by daddydave »

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: Rename text file based on contents
« Reply #1 on: October 11, 2010, 03:27 PM »
This would be a piece of cake to do in AHK...do you still need something?

daddydave

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 867
  • test
    • View Profile
    • Donate to Member
Re: Rename text file based on contents
« Reply #2 on: October 11, 2010, 04:52 PM »
Not at this time...Pfrank does it but working through the rename steps, there seems to be more to it than meets the eye..

and ideally whatever renames it should probably be creating the wiki links and filtering out illegal characters in both the filename and in the wiki link so we are sure they are created by the same rules and therefore match..

And I think I am going in another direction now, but thanks for the offer.