Basically, I have 50 to 100 text files dumped into a single directory. The first line of each text file has a customer number. Example: 150, 750, 2151, etc.
I am wanting to make a button or script where it searches each file for a regex like ^150$ and when it finds the customer number, it renames the file with the customer number first in the name like this:
Search for 150 > rename all matching files to 150_oldname.txt
Search for 750 > rename all matching files to 750_oldname.txt
I already have a button set to go to the folder automatically. I have searches set up to find the files, but if can autumate this into one button it would be great. What would be a good way to do this?
Sure, thanks Leo. I have attached a sample folder with order files. (I have manually renamed the files to be correct) You'll notice the first line of each file matches the first part of the file name. Pretty simple stuff.