here is the code i will provide i want you to update the code so that the folders.ejs file can be according to the structure:


folders.ejs:
<!DOCTYPE html>
<html>
  <head>
    <title>Folder Structure</title>
  </head>
  <body>
    <h1>Folder Structure</h1>
    <ul>
      <% function renderFolder(folder) { %>
      <li class="folder">
        <%= folder.folderName %> <% if (folder.files && folder.files.length > 0)
        { %>
        <ul>
          <% for (const file of folder.files) { %>
          <li>
            <input type="checkbox" name="files[]" value="<%= file.path %>" />
            <%= file.fileName %>
          </li>
          <% } %>
        </ul>
        <% } %> <% if (folder.subFolders && folder.subFolders.length > 0) { %>
        <ul>
          <% for (const subFolder of folder.subFolders) { %> <%=
          renderFolder(subFolder) %> <% } %>
        </ul>
        <% } %>
      </li>
      <% return ""; %> <% } %> <% for (const folder of folderData) { %> <%=
      renderFolder(folder) %> <% } %>
    </ul>
    <form action="/extract" method="post">
      <label for="folderName">Who is the bot for?</label>
      <input type="text" name="folName" id="folderName" />
    </form>
    <button onclick="extractFiles()">Get Files</button>


    <script>
      function extractFiles() {
        const checkboxes = document.querySelectorAll(
          'input[type="checkbox"]:checked'
        );
        const files = Array.from(checkboxes).map((checkbox) => checkbox.value);
        const folderName = document.getElementById("folderName");
        console.log(folderName.value);


        fetch("/extract", {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
          },
          body: JSON.stringify({ files, folderName: folderName.value }),
        })
          .then((response) => {
            if (response.ok) {
              console.log("Files copied successfully!");
            } else {
              console.error("Failed to copy files.");
            }
          })
          .catch((error) => {
            console.error("Error:", error);
          });
      }
    </script>
  </body>
</html>


structure:


[
  {
    "folderName": "buttons",
    "files": [
      {
        "fileName": "verify.js",
        "path": "buttons\\verify.js"
      }
    ],
    "subFolders": []
  },
  {
    "folderName": "commands",
    "files": [],
    "subFolders": [
      {
        "folderName": "info",
        "files": [
          {
            "fileName": "invite.js",
            "path": "commands\\info\\invite.js"
          },
          {
            "fileName": "ping.js",
            "path": "commands\\info\\ping.js"
          }
        ],
        "subFolders": []
      }
    ]
  },
  {
    "folderName": "events",
    "files": [],
    "subFolders": [
      {
        "folderName": "ChannelLogs",
        "files": [
          {
            "fileName": "channelCreate.js",
            "path": "events\\ChannelLogs\\channelCreate.js"
          },
          {
            "fileName": "channelDelete.js",
            "path": "events\\ChannelLogs\\channelDelete.js"
          },
          {
            "fileName": "channelUpdate.js",
            "path": "events\\ChannelLogs\\channelUpdate.js"
          }
        ],
        "subFolders": []
      },
      {
        "folderName": "Client",
        "files": [
          {
            "fileName": "ready.js",
            "path": "events\\Client\\ready.js"
          }
        ],
        "subFolders": []
      },
      {
        "folderName": "Interaction",
        "files": [
          {
            "fileName": "buttonInteraction.js",
            "path": "events\\Interaction\\buttonInteraction.js"
          },
          {
            "fileName": "interactionCreate.js",
            "path": "events\\Interaction\\interactionCreate.js"
          }
        ],
        "subFolders": []
      },
      {
        "folderName": "Messages",
        "files": [
          {
            "fileName": "messageCreate.js",
            "path": "events\\Messages\\messageCreate.js"
          }
        ],
        "subFolders": []
      },
      {
        "folderName": "UserLogs",
        "files": [
          {
            "fileName": "memberBanned.js",
            "path": "events\\UserLogs\\memberBanned.js"
          },
          {
            "fileName": "memberJoined.js",
            "path": "events\\UserLogs\\memberJoined.js"
          },
          {
            "fileName": "memberLeft.js",
            "path": "events\\UserLogs\\memberLeft.js"
          },
          {
            "fileName": "memberUnbanned.js",
            "path": "events\\UserLogs\\memberUnbanned.js"
          },
          {
            "fileName": "memberUpdate.js",
            "path": "events\\UserLogs\\memberUpdate.js"
          },
          {
            "fileName": "messageDelete.js",
            "path": "events\\UserLogs\\messageDelete.js"
          },
          {
            "fileName": "messageUpdate.js",
            "path": "events\\UserLogs\\messageUpdate.js"
          }
        ],
        "subFolders": []
      }
    ]
  },
  {
    "folderName": "handlers",
    "files": [
      {
        "fileName": "buttons.js",
        "path": "handlers\\buttons.js"
      },
      {
        "fileName": "command.js",
        "path": "handlers\\command.js"
      },
      {
        "fileName": "events.js",
        "path": "handlers\\events.js"
      },
      {
        "fileName": "slashCommand.js",
        "path": "handlers\\slashCommand.js"
      }
    ],
    "subFolders": []
  },
  {
    "folderName": "slashCommands",
    "files": [
      {
        "fileName": "stats.js",
        "path": "slashCommands\\stats.js"
      },
      {
        "fileName": "whois.js",
        "path": "slashCommands\\whois.js"
      }
    ],
    "subFolders": [
      {
        "folderName": "misc",
        "files": [
          {
            "fileName": "rolldice.js",
            "path": "slashCommands\\misc\\rolldice.js"
          }
        ],
        "subFolders": []
      },
      {
        "folderName": "moderation",
        "files": [
          {
            "fileName": "ban.js",
            "path": "slashCommands\\moderation\\ban.js"
          },
          {
            "fileName": "kick.js",
            "path": "slashCommands\\moderation\\kick.js"
          },
          {
            "fileName": "mute.js",
            "path": "slashCommands\\moderation\\mute.js"
          },
          {
            "fileName": "tempban.js",
            "path": "slashCommands\\moderation\\tempban.js"
          },
          {
            "fileName": "timeout.js",
            "path": "slashCommands\\moderation\\timeout.js"
          },
          {
            "fileName": "unban.js",
            "path": "slashCommands\\moderation\\unban.js"
          },
          {
            "fileName": "unmute.js",
            "path": "slashCommands\\moderation\\unmute.js"
          }
        ],
        "subFolders": []
      }
    ]
  },
  {
    "folderName": "slashSubcommands",
    "files": [],
    "subFolders": [
      {
        "folderName": "games",
        "files": [
          {
            "fileName": "index.js",
            "path": "slashSubcommands\\games\\index.js"
          },
          {
            "fileName": "quickstart.js",
            "path": "slashSubcommands\\games\\quickstart.js"
          }
        ],
        "subFolders": [
          {
            "folderName": "life",
            "files": [
              {
                "fileName": "play.js",
                "path": "slashSubcommands\\games\\life\\play.js"
              }
            ],
            "subFolders": []
          },
          {
            "folderName": "monopoly",
            "files": [
              {
                "fileName": "play.js",
                "path": "slashSubcommands\\games\\monopoly\\play.js"
              }
            ],
            "subFolders": []
          },
          {
            "folderName": "uno",
            "files": [
              {
                "fileName": "play.js",
                "path": "slashSubcommands\\games\\uno\\play.js"
              }
            ],
            "subFolders": []
          }
        ]
      }
    ]
  },
  {
    "folderName": "utils",
    "files": [
      {
        "fileName": "BaseSlashCommand.js",
        "path": "utils\\BaseSlashCommand.js"
      },
      {
        "fileName": "BaseSlashSubcommand.js",
        "path": "utils\\BaseSlashSubcommand.js"
      },
      {
        "fileName": "BaseSubcommandExecutor.js",
        "path": "utils\\BaseSubcommandExecutor.js"
      },
      {
        "fileName": "PermChecks.js",
        "path": "utils\\PermChecks.js"
      },
      {
        "fileName": "registry.js",
        "path": "utils\\registry.js"
      }
    ],
    "subFolders": []
  }
]