Renaming and saving text files based on its content
-
Hi,
I’ve got hundreds of .html-Files of a Forum and I want to rename and save them the following way. Each File consists, among many other lines, of the following line:<td align="left" valign="middle" class="nav" width="100%"><span class="nav"><a href="index.php?sid=a6ddafec8f3ed8a0a7cf4f8bf8273cff" class="nav">ONE</a><a href="./index.php" class="nav">TWO</a> » <a href="./viewforum.php" class="nav">THREE</a><a href="./viewtopic.php" class="nav">FOUR</a></span></td>
My goals: (THREE, FOUR are just a placeholders here and different in each file)
- Rename each file to “FOUR.html”
- save the file in directory: “Forum/THREE”
How to do this in a smart way for all hundreds of files using Windows?
Is it possible with Notepadd++, a Macro, a script, or better be done with Windows-PowerShell?Btw: I’ve Regex-Knowhow, so I’m able to create the final Regex myself. It’s just about what tools to use for.
-
@Sam-Cem ,
Is it possible with Notepadd++, a Macro, a script, or better be done with Windows-PowerShell?
Notepad++ macros cannot rename files, so Notepad++ cannot do this natively.
You would either need to use one of the scripting plugins (like PythonScript) if you wanted to stay inside Notepad++, or use some external scripting language (like PowerShell) if you’re fine with that. I don’t see much benefit of doing it within Notepad++ using a scripting plugin, unless you’re more comfortable writing the code in Python than in PowerShell (and if you are, you could probably just as easily write it in normal Python code, without the PythonScript interface).
-
@Sam-Cem You can click and read How to replace a particular “url” with “url” of each webpage in multiple files using Notepad++? - I used the solution 2 mentioned at codeproject.com (the link to the codeproject.com webpage can be seen if you click the link I have mentioned above - do not click on the, “codeproject.com” link mentioned here).