RetroDECK icon indicating copy to clipboard operation
RetroDECK copied to clipboard

Tool: Multi-file structure creator

Open Lazorne opened this issue 2 years ago • 1 comments

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.

Lazorne avatar Jun 16 '23 15:06 Lazorne

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.

XargonWan avatar Oct 09 '23 10:10 XargonWan

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

XargonWan avatar Mar 21 '24 13:03 XargonWan

Duplicate of: https://github.com/XargonWan/RetroDECK/issues/286

XargonWan avatar May 08 '24 12:05 XargonWan