How to make a script to move files with find and regex












0















Im trying to make a find regex script so i automaticly can copy files to specific directory.



find . -regex "*test.*s01e([0-9][0-9]).*" -exec cp {} /storage/tv/test/s01/ ;


Made this script, dont get any errors but it doesnt list anything.
Also tried to just run the command in terminal and still the command runs without error but doesnt list anything.
Is there something wrong i have done or is this something that's not easy to get to work?










share|improve this question
















bumped to the homepage by Community 29 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    0















    Im trying to make a find regex script so i automaticly can copy files to specific directory.



    find . -regex "*test.*s01e([0-9][0-9]).*" -exec cp {} /storage/tv/test/s01/ ;


    Made this script, dont get any errors but it doesnt list anything.
    Also tried to just run the command in terminal and still the command runs without error but doesnt list anything.
    Is there something wrong i have done or is this something that's not easy to get to work?










    share|improve this question
















    bumped to the homepage by Community 29 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      0












      0








      0








      Im trying to make a find regex script so i automaticly can copy files to specific directory.



      find . -regex "*test.*s01e([0-9][0-9]).*" -exec cp {} /storage/tv/test/s01/ ;


      Made this script, dont get any errors but it doesnt list anything.
      Also tried to just run the command in terminal and still the command runs without error but doesnt list anything.
      Is there something wrong i have done or is this something that's not easy to get to work?










      share|improve this question
















      Im trying to make a find regex script so i automaticly can copy files to specific directory.



      find . -regex "*test.*s01e([0-9][0-9]).*" -exec cp {} /storage/tv/test/s01/ ;


      Made this script, dont get any errors but it doesnt list anything.
      Also tried to just run the command in terminal and still the command runs without error but doesnt list anything.
      Is there something wrong i have done or is this something that's not easy to get to work?







      find regular-expression






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 20 '15 at 22:57









      Gilles

      535k12810811598




      535k12810811598










      asked Jan 20 '15 at 13:00









      stonestone

      12




      12





      bumped to the homepage by Community 29 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 29 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          2 Answers
          2






          active

          oldest

          votes


















          0














          GNU findutils uses Emacs style regex, so out of box, this should suffice:



          find . -regex '.*test.s01e[0-9][0-9]' -exec cp {} /storage/tv/test/s01 ;





          share|improve this answer
























          • Thanks for the reply, but it does not seem to work. If i use find . -name test.s01e03* works fine, but then i need to specify the filename instead of searching for test.s01([0-9][0-9]) with regex. but this simple regex script works like a charm, but cant get the other one to work. find -regex ".*(jpg|png)"

            – stone
            Jan 20 '15 at 13:39











          • In that case, I don't really follow what you're trying to do ... Is your intent to copy (for example) s01e01 file to /storage/tv/test/s01/ as 01?

            – Priit
            Jan 20 '15 at 13:41



















          0














          Found the solution



          find . -regex '.*test.*s01e[0-9][0-9].*720p.*x264.*' -exec cp {} /storage/tv/test/s01/ ;





          share|improve this answer























            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',
            autoActivateHeartbeat: false,
            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%2f180049%2fhow-to-make-a-script-to-move-files-with-find-and-regex%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            GNU findutils uses Emacs style regex, so out of box, this should suffice:



            find . -regex '.*test.s01e[0-9][0-9]' -exec cp {} /storage/tv/test/s01 ;





            share|improve this answer
























            • Thanks for the reply, but it does not seem to work. If i use find . -name test.s01e03* works fine, but then i need to specify the filename instead of searching for test.s01([0-9][0-9]) with regex. but this simple regex script works like a charm, but cant get the other one to work. find -regex ".*(jpg|png)"

              – stone
              Jan 20 '15 at 13:39











            • In that case, I don't really follow what you're trying to do ... Is your intent to copy (for example) s01e01 file to /storage/tv/test/s01/ as 01?

              – Priit
              Jan 20 '15 at 13:41
















            0














            GNU findutils uses Emacs style regex, so out of box, this should suffice:



            find . -regex '.*test.s01e[0-9][0-9]' -exec cp {} /storage/tv/test/s01 ;





            share|improve this answer
























            • Thanks for the reply, but it does not seem to work. If i use find . -name test.s01e03* works fine, but then i need to specify the filename instead of searching for test.s01([0-9][0-9]) with regex. but this simple regex script works like a charm, but cant get the other one to work. find -regex ".*(jpg|png)"

              – stone
              Jan 20 '15 at 13:39











            • In that case, I don't really follow what you're trying to do ... Is your intent to copy (for example) s01e01 file to /storage/tv/test/s01/ as 01?

              – Priit
              Jan 20 '15 at 13:41














            0












            0








            0







            GNU findutils uses Emacs style regex, so out of box, this should suffice:



            find . -regex '.*test.s01e[0-9][0-9]' -exec cp {} /storage/tv/test/s01 ;





            share|improve this answer













            GNU findutils uses Emacs style regex, so out of box, this should suffice:



            find . -regex '.*test.s01e[0-9][0-9]' -exec cp {} /storage/tv/test/s01 ;






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 20 '15 at 13:18









            PriitPriit

            291




            291













            • Thanks for the reply, but it does not seem to work. If i use find . -name test.s01e03* works fine, but then i need to specify the filename instead of searching for test.s01([0-9][0-9]) with regex. but this simple regex script works like a charm, but cant get the other one to work. find -regex ".*(jpg|png)"

              – stone
              Jan 20 '15 at 13:39











            • In that case, I don't really follow what you're trying to do ... Is your intent to copy (for example) s01e01 file to /storage/tv/test/s01/ as 01?

              – Priit
              Jan 20 '15 at 13:41



















            • Thanks for the reply, but it does not seem to work. If i use find . -name test.s01e03* works fine, but then i need to specify the filename instead of searching for test.s01([0-9][0-9]) with regex. but this simple regex script works like a charm, but cant get the other one to work. find -regex ".*(jpg|png)"

              – stone
              Jan 20 '15 at 13:39











            • In that case, I don't really follow what you're trying to do ... Is your intent to copy (for example) s01e01 file to /storage/tv/test/s01/ as 01?

              – Priit
              Jan 20 '15 at 13:41

















            Thanks for the reply, but it does not seem to work. If i use find . -name test.s01e03* works fine, but then i need to specify the filename instead of searching for test.s01([0-9][0-9]) with regex. but this simple regex script works like a charm, but cant get the other one to work. find -regex ".*(jpg|png)"

            – stone
            Jan 20 '15 at 13:39





            Thanks for the reply, but it does not seem to work. If i use find . -name test.s01e03* works fine, but then i need to specify the filename instead of searching for test.s01([0-9][0-9]) with regex. but this simple regex script works like a charm, but cant get the other one to work. find -regex ".*(jpg|png)"

            – stone
            Jan 20 '15 at 13:39













            In that case, I don't really follow what you're trying to do ... Is your intent to copy (for example) s01e01 file to /storage/tv/test/s01/ as 01?

            – Priit
            Jan 20 '15 at 13:41





            In that case, I don't really follow what you're trying to do ... Is your intent to copy (for example) s01e01 file to /storage/tv/test/s01/ as 01?

            – Priit
            Jan 20 '15 at 13:41













            0














            Found the solution



            find . -regex '.*test.*s01e[0-9][0-9].*720p.*x264.*' -exec cp {} /storage/tv/test/s01/ ;





            share|improve this answer




























              0














              Found the solution



              find . -regex '.*test.*s01e[0-9][0-9].*720p.*x264.*' -exec cp {} /storage/tv/test/s01/ ;





              share|improve this answer


























                0












                0








                0







                Found the solution



                find . -regex '.*test.*s01e[0-9][0-9].*720p.*x264.*' -exec cp {} /storage/tv/test/s01/ ;





                share|improve this answer













                Found the solution



                find . -regex '.*test.*s01e[0-9][0-9].*720p.*x264.*' -exec cp {} /storage/tv/test/s01/ ;






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 20 '15 at 13:45









                stonestone

                12




                12






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f180049%2fhow-to-make-a-script-to-move-files-with-find-and-regex%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    サソリ

                    広島県道265号伴広島線

                    Setup Asymptote in Texstudio