DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Rename text file based on contents  (Read 3,803 times)

daddydave

  • test
  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 867
    • Participated in NANY Challenge Once
Rename text file based on contents
« on: October 09, 2010, 10: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, 10:12 PM by daddydave »

skwire

  • I eat Coding Snacks for breakfast...
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,297
    • Participated in NANY Challenge Seventeen Times
    • Coding Snacks
    • Superboy Coder
    • Cody Award
    • Volunteers/Staff
    • Gathering Badge
Re: Rename text file based on contents
« Reply #1 on: October 11, 2010, 08:27 PM »
This would be a piece of cake to do in AHK...do you still need something?

daddydave

  • test
  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 867
    • Participated in NANY Challenge Once
Re: Rename text file based on contents
« Reply #2 on: October 11, 2010, 09: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.

Original address: https://www.donationcoder.com/forum/index.php?topic=24219.0