Rename files based on data from within
-
I have several hundred config files on a Windows 2019 Server that are named by their MAC address but want to rename them based on their extension which is located within.
The original file is 14AEDB1A0DE1.cfg and I would like it named 2200.cfg which comes from this line within the file.
user_name=06300000542200 -
That’s really not a task that a “text editor” is good at doing on its own.
If you add on the PythonScript plugin, or one of the other scripting plugins, it’s possible. (In pythonscript, I would do an
editor.research(r'user_name=\w+(....)\b', someFunction), and then definesomeFunctionso that it uses them.group(1)text to rename the file. But honestly, with the same amount of work, I could do it outside Notepad++ in the programming language of my choice, in probably 2-3 lines of real code, without requiring that the file be open in Notepad++ first) -
I don’t know win2019 server but what you ask is possible to be done even with just few rows of powershell or vbs code, if the OS has one of them.
Also if the files you have to handle have a fixed schema will be relatively easy to implement a script.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login