This is the script i used.
Make sure to replace "/path/to/files" with the actual directory path where your files are located.
#!/bin/bash
# Set the directory where the files are located
files_directory="/path/to/files"
# Change to the files directory
cd "$files_directory" || exit
# Iterate over each file in the directory
for file in *; do
# Check if the item is a file (not a directory)
if [[ -f $file ]]; then
# Extract the file name without the extension
file_name=$(basename "$file")
file_name_without_extension="${file_name%.*}"
# Create a folder with the same name as the file (if it doesn't exist)
mkdir -p "$file_name_without_extension"
# Move the file into the newly created folder
mv "$file" "$file_name_without_extension"
fi
done