Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Path to the text file containing the names
- names_file="/home/pi/verticalroms.txt"
- # Folder containing the ROM files
- roms_folder="/home/pi/RetroPie/roms/mame-libretro/mame2003-plus"
- # Destination folder for the found files
- destination_folder="/home/pi/RetroPie/roms/mame_tate"
- # Check if the names file exists
- if [ ! -f "$names_file" ]; then
- echo "The names file does not exist: $names_file"
- exit 1
- fi
- # Check if the ROMs folder exists
- if [ ! -d "$roms_folder" ]; then
- echo "The ROMs folder does not exist: $roms_folder"
- exit 1
- fi
- # Check if the destination folder exists, otherwise create it
- if [ ! -d "$destination_folder" ]; then
- echo "The destination folder does not exist, creating it..."
- mkdir -p "$destination_folder"
- fi
- # Read the names from the file and compare with the names of the files in the ROMs folder
- while IFS= read -r name || [ -n "$name" ]; do
- # Remove any whitespace
- name=$(echo "$name" | tr -d '[:space:]')
- # Check if the file exists in the ROMs folder
- if [ -f "$roms_folder/$name.zip" ]; then
- echo "Found: $name.zip"
- # Move the file to the destination folder
- mv "$roms_folder/$name.zip" "$destination_folder/"
- echo "File moved to $destination_folder"
- fi
- done < "$names_file"
- echo "Operation completed."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement