[+] filter_directory_content

Allows a user to extract the files having a specific extension
This commit is contained in:
Charles Le Maux 2024-09-11 04:15:40 +02:00
parent b558b02711
commit 6832b05230

View File

@ -2,8 +2,8 @@ import datetime
import json
import logging
import os
import shutil
import re
import shutil
supported_versions = ["bukkit", "paper", "spigot"]
@ -102,6 +102,15 @@ def get_path_from_extension(filename) -> str or None:
return None
def filter_directory_contents(desired_extension: str, directory_contents: list[str]):
filtered_list = []
for item in directory_contents:
_, ext = os.path.splitext(item)
if ext.lower() == desired_extension:
filtered_list.append(item)
return filtered_list
def kebab_to_camel_case(s: str) -> str:
parts = s.split('-')
return parts[0] + ''.join(part.title() for part in parts[1:])