RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    bash command for this code need help

    Scheduled Pinned Locked Moved Help and Support
    bash commandscript
    4 Posts 2 Posters 383 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      kok00
      last edited by

      Folder location /home/pi/RetroPie/roms
      contains

      streetf1.zip
      ssfx2.zip
      turbo2.zip
      mgaman.zip
      shnobi.zip
      tkken.zip
      donkey.zip
      suprman.zip

      Folder location /opt/retropie/configs/all/emulationstation/downloaded_images/
      contains files

      streetf1.zip
      ssfx2.jpg
      turbo2.jpg
      mgaman.jpg
      shnobi.jpg
      tkken.jpg

      Scan and compare both locations path and if the .zip has missing images then move the .zip files to new created folder in same path.

      #!/bin/bash
         file1="/home/pi/RetroPie/roms"
         file2="/opt/retropie/configs/all/emulationstation/downloaded_images/"
         
             if cmp -s "$file1" "$file2"; then
                 printf 'The file "%s" is the same as "%s"\n' "$file1" "$file2"
         #if title.zip and image.jpg title matches then ignore it
             else
                 printf 'The file "%s" is different from "%s"\n' "$file1" "$file2"
         #if title.zip and image title not match then create a folder and move all .zip files with missing images.
             fi
      

      this path /home/pi/RetroPie/roms contains alot of .zip so i need something to loop through both path and do the work.

      cyperghostC 1 Reply Last reply Reply Quote 0
      • cyperghostC
        cyperghost @kok00
        last edited by

        @kok00 hmmm you compare a zipped rom file with a image file. Very interesting ...
        You know this won't work.

        This would be better
        https://github.com/meleu/share/blob/master/images-cleaner.sh

        1 Reply Last reply Reply Quote 0
        • K
          kok00
          last edited by

          it will work only compare the title and not extension?

          cyperghostC 1 Reply Last reply Reply Quote 0
          • cyperghostC
            cyperghost @kok00
            last edited by

            @kok00 cmp does not care of file names, it compares content

            1 Reply Last reply Reply Quote 0
            • First post
              Last post

            Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

            Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.