Advertisement
chriz74x

Untitled

May 3rd, 2024
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. # Path to the text file containing the names
  4. names_file="/home/pi/verticalroms.txt"
  5.  
  6. # Folder containing the ROM files
  7. roms_folder="/home/pi/RetroPie/roms/mame-libretro/mame2003-plus"
  8.  
  9. # Destination folder for the found files
  10. destination_folder="/home/pi/RetroPie/roms/mame_tate"
  11.  
  12. # Check if the names file exists
  13. if [ ! -f "$names_file" ]; then
  14.     echo "The names file does not exist: $names_file"
  15.     exit 1
  16. fi
  17.  
  18. # Check if the ROMs folder exists
  19. if [ ! -d "$roms_folder" ]; then
  20.     echo "The ROMs folder does not exist: $roms_folder"
  21.     exit 1
  22. fi
  23.  
  24. # Check if the destination folder exists, otherwise create it
  25. if [ ! -d "$destination_folder" ]; then
  26.     echo "The destination folder does not exist, creating it..."
  27.     mkdir -p "$destination_folder"
  28. fi
  29.  
  30. # Read the names from the file and compare with the names of the files in the ROMs folder
  31. while IFS= read -r name || [ -n "$name" ]; do
  32.    # Remove any whitespace
  33.     name=$(echo "$name" | tr -d '[:space:]')
  34.    # Check if the file exists in the ROMs folder
  35.     if [ -f "$roms_folder/$name.zip" ]; then
  36.         echo "Found: $name.zip"
  37.        # Move the file to the destination folder
  38.         mv "$roms_folder/$name.zip" "$destination_folder/"
  39.         echo "File moved to $destination_folder"
  40.     fi
  41. done < "$names_file"
  42.  
  43. echo "Operation completed."
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement