Looking for missing files in a directory of files via wildcard inputs

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I currently have a directory with 100 files of 4 types, for a total of 400 files. I would like to find which ones are missing. My current script is:



for((i=1; i<=100; i++)); do name="File_Type_1_$i.RData"; 
[[ ! -e "$name" ]] && echo "missing $name"; done

for((i=1; i<=100; i++)); do name="File_Type_2_$i.RData";
[[ ! -e "$name" ]] && echo "missing $name"; done

for((i=1; i<=100; i++)); do name="File_Type_3_$i.RData";
[[ ! -e "$name" ]] && echo "missing $name"; done

for((i=1; i<=100; i++)); do name="File_Type_4_$i.RData";
[[ ! -e "$name" ]] && echo "missing $name"; done


which is annoying to have to run 4 times. Is there a way to run everything at once? The









share

























    up vote
    0
    down vote

    favorite












    I currently have a directory with 100 files of 4 types, for a total of 400 files. I would like to find which ones are missing. My current script is:



    for((i=1; i<=100; i++)); do name="File_Type_1_$i.RData"; 
    [[ ! -e "$name" ]] && echo "missing $name"; done

    for((i=1; i<=100; i++)); do name="File_Type_2_$i.RData";
    [[ ! -e "$name" ]] && echo "missing $name"; done

    for((i=1; i<=100; i++)); do name="File_Type_3_$i.RData";
    [[ ! -e "$name" ]] && echo "missing $name"; done

    for((i=1; i<=100; i++)); do name="File_Type_4_$i.RData";
    [[ ! -e "$name" ]] && echo "missing $name"; done


    which is annoying to have to run 4 times. Is there a way to run everything at once? The









    share























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I currently have a directory with 100 files of 4 types, for a total of 400 files. I would like to find which ones are missing. My current script is:



      for((i=1; i<=100; i++)); do name="File_Type_1_$i.RData"; 
      [[ ! -e "$name" ]] && echo "missing $name"; done

      for((i=1; i<=100; i++)); do name="File_Type_2_$i.RData";
      [[ ! -e "$name" ]] && echo "missing $name"; done

      for((i=1; i<=100; i++)); do name="File_Type_3_$i.RData";
      [[ ! -e "$name" ]] && echo "missing $name"; done

      for((i=1; i<=100; i++)); do name="File_Type_4_$i.RData";
      [[ ! -e "$name" ]] && echo "missing $name"; done


      which is annoying to have to run 4 times. Is there a way to run everything at once? The









      share













      I currently have a directory with 100 files of 4 types, for a total of 400 files. I would like to find which ones are missing. My current script is:



      for((i=1; i<=100; i++)); do name="File_Type_1_$i.RData"; 
      [[ ! -e "$name" ]] && echo "missing $name"; done

      for((i=1; i<=100; i++)); do name="File_Type_2_$i.RData";
      [[ ! -e "$name" ]] && echo "missing $name"; done

      for((i=1; i<=100; i++)); do name="File_Type_3_$i.RData";
      [[ ! -e "$name" ]] && echo "missing $name"; done

      for((i=1; i<=100; i++)); do name="File_Type_4_$i.RData";
      [[ ! -e "$name" ]] && echo "missing $name"; done


      which is annoying to have to run 4 times. Is there a way to run everything at once? The







      bash wildcards





      share












      share










      share



      share










      asked 4 mins ago









      user321627

      1233




      1233




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          ls -l File_type_1..4_1..100.RData > /dev/null


          This command uses brace expansion to generate all 400 filenames, then asks ls to list them, only we immediately redirect the output to /dev/null, dropping it. ls will complain about the missing files to stderr; for example:



          ls: cannot access 'File_type_1_99.RData': No such file or directory
          ls: cannot access 'File_type_3_42.RData': No such file or directory


          Therein lie the missing files!





          share




















            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f479506%2flooking-for-missing-files-in-a-directory-of-files-via-wildcard-inputs%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            ls -l File_type_1..4_1..100.RData > /dev/null


            This command uses brace expansion to generate all 400 filenames, then asks ls to list them, only we immediately redirect the output to /dev/null, dropping it. ls will complain about the missing files to stderr; for example:



            ls: cannot access 'File_type_1_99.RData': No such file or directory
            ls: cannot access 'File_type_3_42.RData': No such file or directory


            Therein lie the missing files!





            share
























              up vote
              0
              down vote













              ls -l File_type_1..4_1..100.RData > /dev/null


              This command uses brace expansion to generate all 400 filenames, then asks ls to list them, only we immediately redirect the output to /dev/null, dropping it. ls will complain about the missing files to stderr; for example:



              ls: cannot access 'File_type_1_99.RData': No such file or directory
              ls: cannot access 'File_type_3_42.RData': No such file or directory


              Therein lie the missing files!





              share






















                up vote
                0
                down vote










                up vote
                0
                down vote









                ls -l File_type_1..4_1..100.RData > /dev/null


                This command uses brace expansion to generate all 400 filenames, then asks ls to list them, only we immediately redirect the output to /dev/null, dropping it. ls will complain about the missing files to stderr; for example:



                ls: cannot access 'File_type_1_99.RData': No such file or directory
                ls: cannot access 'File_type_3_42.RData': No such file or directory


                Therein lie the missing files!





                share












                ls -l File_type_1..4_1..100.RData > /dev/null


                This command uses brace expansion to generate all 400 filenames, then asks ls to list them, only we immediately redirect the output to /dev/null, dropping it. ls will complain about the missing files to stderr; for example:



                ls: cannot access 'File_type_1_99.RData': No such file or directory
                ls: cannot access 'File_type_3_42.RData': No such file or directory


                Therein lie the missing files!






                share











                share


                share










                answered 17 secs ago









                Jeff Schaller

                35.2k952115




                35.2k952115



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f479506%2flooking-for-missing-files-in-a-directory-of-files-via-wildcard-inputs%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay