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>&nbsp;&raquo;&nbsp;<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)

  1. Rename each file to “FOUR.html”
  2. save the file in directory: “Forum/THREE”

How is this possible in a smart way using PowerShell on Windows 10?
Thank you very much!

Sam,
Welcome to the forum. :wave:t3:

This forum is for scripting questions rather than script requests. We do not write customized and ready to use scripts or solutions on request.

We actually expect you to make an own attempt at the first place to get your task done or to solve your problem. If you have done so already please document here what exactly you have done and show your code. Then we probably might be able to help you step further.

To get you started you may start to read the help for the following PowerShell cmdlets:

Please always read the help for the cmdlets you’re about to use completely including the examples to learn how to use them.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.