Tool: Multi-file structure creator
The goal of this tool is that is checks if roms in a selected roms folder and tries to create a multi-file structure of multiple file or disc games.
So it creates the file structure, moves the roms into a subfolder.m3u and the create the m3u textfile.
VITA3K The user configuration for Vita3K is found in ux0/user/## folder, so if we want to really have different users we need to parse the user.xml file and edit it accordignly as any user got its files. At the moment exists only one user called RetroDECK.
NOTE: the same can be valid for PS3 as well as they're using a very similar system. And probably other operative-system based emulators as well such as Xbox, Wii, WiiU and Switch may need to be taken care similarly.
Proto script that I did, it worked very well with my collection:
#!/bin/bash
# Function to create multidisk directories
create_multidisk_directories() {
echo "Checking for games with multiple .chd files..."
# Loop through each file in the current directory
for file in *; do
# Check if file name contains Disc/Disk/CD
if [[ "$file" =~ (Disc|Disk|CD) ]]; then
echo "Found game with possible multidisk: $file"
# Get base name without (Disc X) part
base_name=$(echo "$file" | sed -E 's/ \(Disc [0-9]+\)\.chd//')
# Create a directory for the game
mkdir -p "$base_name.m3u"
# Move the files into the game directory
mv "$file" "$base_name.m3u/"
mv "${base_name}*(Disc|Disk|CD)*.chd" "$base_name.m3u/"
# Change directory to the game directory
cd "$base_name.m3u" || exit
# Create the .m3u file
touch "${base_name}.m3u"
# Write unique .chd file names to .m3u file
for chd_file in *.chd; do
if ! grep -q "$chd_file" "${base_name}.m3u"; then
echo "$chd_file" >> "${base_name}.m3u"
fi
done
echo "Multidisk directory created for: $base_name"
# Move back to original directory
cd ..
else
echo "Skipping $file, does not contain Disc/Disk/CD in filename."
fi
done
echo "Multidisk directories creation complete."
}
# Call function to create multidisk directories
create_multidisk_directories
Duplicate of: https://github.com/XargonWan/RetroDECK/issues/286