MV exclude folder not working Announcing the arrival of Valued Associate #679: Cesar Manara ...

Error "illegal generic type for instanceof" when using local classes

What is Wonderstone and are there any references to it pre-1982?

What is the meaning of the new sigil in Game of Thrones Season 8 intro?

3 doors, three guards, one stone

Apollo command module space walk?

What is the logic behind the Maharil's explanation of why we don't say שעשה ניסים on Pesach?

Withdrew £2800, but only £2000 shows as withdrawn on online banking; what are my obligations?

How discoverable are IPv6 addresses and AAAA names by potential attackers?

Book where humans were engineered with genes from animal species to survive hostile planets

Can an alien society believe that their star system is the universe?

Understanding Ceva's Theorem

Do I really need recursive chmod to restrict access to a folder?

What does an IRS interview request entail when called in to verify expenses for a sole proprietor small business?

How to find all the available tools in mac terminal?

What exactly is a "Meth" in Altered Carbon?

How do pianists reach extremely loud dynamics?

Sci-Fi book where patients in a coma ward all live in a subconscious world linked together

How can I make names more distinctive without making them longer?

Denied boarding although I have proper visa and documentation. To whom should I make a complaint?

What is Arya's weapon design?

How to call a function with default parameter through a pointer to function that is the return of another function?

Dating a Former Employee

What is known about the Ubaid lizard-people figurines?

Why did the rest of the Eastern Bloc not invade Yugoslavia?



MV exclude folder not working



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionHow do I correct a directory incorrectly copied into itself?find file, copy but with different namebash syntax error near unexpected token `(' - but everything looks like it should work'Tar' the result of a 'find', preserving the directory structureCopy tree directory from specific pointshopt -s extglob not working as expectedexecutable within $PATH still going unrecognizedHow to rename files recursively in sequential order?How can I copy a specific line to a specific folder? - Debian/Bash/LinuxBash for loop on all files in folder except one





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I'm trying to copy all of the files/directories inside a folder but would like to exclude one folder as I want all the other file to be inside that folder. To better demonstrate below is the folder structure



- VideosFolder
L File1
L File2
L File3
L TutorialFolder


Now I want File1 File2 File3 to be moved to TutorialFolder like so



- VideosFolder
L TutorialFolder
L File1
L File2
L File3


I tried this command




mv ~/Desktop/VideosFolder/!(TutorialFolder) TutorialFolder




But I get this error




mv: cannot stat '/home/user/Desktop/VideosFolder/!(TutorialFolder)': No such file or directory




I checked if the shopt extglob is enabled and it is indeed enabled. So I'm not sure how to go about this.










share|improve this question









New contributor




MadzQuestioning is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



























    0















    I'm trying to copy all of the files/directories inside a folder but would like to exclude one folder as I want all the other file to be inside that folder. To better demonstrate below is the folder structure



    - VideosFolder
    L File1
    L File2
    L File3
    L TutorialFolder


    Now I want File1 File2 File3 to be moved to TutorialFolder like so



    - VideosFolder
    L TutorialFolder
    L File1
    L File2
    L File3


    I tried this command




    mv ~/Desktop/VideosFolder/!(TutorialFolder) TutorialFolder




    But I get this error




    mv: cannot stat '/home/user/Desktop/VideosFolder/!(TutorialFolder)': No such file or directory




    I checked if the shopt extglob is enabled and it is indeed enabled. So I'm not sure how to go about this.










    share|improve this question









    New contributor




    MadzQuestioning is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I'm trying to copy all of the files/directories inside a folder but would like to exclude one folder as I want all the other file to be inside that folder. To better demonstrate below is the folder structure



      - VideosFolder
      L File1
      L File2
      L File3
      L TutorialFolder


      Now I want File1 File2 File3 to be moved to TutorialFolder like so



      - VideosFolder
      L TutorialFolder
      L File1
      L File2
      L File3


      I tried this command




      mv ~/Desktop/VideosFolder/!(TutorialFolder) TutorialFolder




      But I get this error




      mv: cannot stat '/home/user/Desktop/VideosFolder/!(TutorialFolder)': No such file or directory




      I checked if the shopt extglob is enabled and it is indeed enabled. So I'm not sure how to go about this.










      share|improve this question









      New contributor




      MadzQuestioning is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I'm trying to copy all of the files/directories inside a folder but would like to exclude one folder as I want all the other file to be inside that folder. To better demonstrate below is the folder structure



      - VideosFolder
      L File1
      L File2
      L File3
      L TutorialFolder


      Now I want File1 File2 File3 to be moved to TutorialFolder like so



      - VideosFolder
      L TutorialFolder
      L File1
      L File2
      L File3


      I tried this command




      mv ~/Desktop/VideosFolder/!(TutorialFolder) TutorialFolder




      But I get this error




      mv: cannot stat '/home/user/Desktop/VideosFolder/!(TutorialFolder)': No such file or directory




      I checked if the shopt extglob is enabled and it is indeed enabled. So I'm not sure how to go about this.







      bash mv shopt






      share|improve this question









      New contributor




      MadzQuestioning is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      MadzQuestioning is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 5 hours ago









      Rui F Ribeiro

      42.1k1484142




      42.1k1484142






      New contributor




      MadzQuestioning is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 5 hours ago









      MadzQuestioningMadzQuestioning

      104




      104




      New contributor




      MadzQuestioning is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      MadzQuestioning is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      MadzQuestioning is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          3 Answers
          3






          active

          oldest

          votes


















          1














          You could just run



          mv * TutorialFolder/


          While in VideosFolder/. This will move all files and directories (not starting with a .) into TutorialFolder/. As you can't move a directory into itself, you will likely get a warning message along the lines of



          mv: cannot move 'TutorialFolder' to a subdirectory of itself, 'TutorialFolder/TutorialFolder'


          This is expected and just means that mv hasn't moved TutorialFolder.






          share|improve this answer
























          • This does work but it's gives a warning. I was thinking of a more cleaner way like what if I want to exclude 2 folder or more then this solution will not fix it. I was really hoping to get an answer about extglob approach as this is more flexible

            – MadzQuestioning
            2 hours ago



















          0














          The other answer works but this is a cleaner way with no errors:



          find . -maxdepth 1 ! ( -name TutorialFolder -o -name '.' ) -exec mv {} TutorialFolder/ ;


          That will find every file and directory in the current directory where the name is not equal to TutorialFolder and . (which is the current directory itself) and then use -exec to mv them into TutorialFolder.






          share|improve this answer































            0














            You can try Rsync command.Rsync is a fast and versatile command line utility that synchronizes files and folders between two locations over a remote shell.



             rsync -a --exclude 'TutorialFolder' ~/Desktop/VideosFolder/  ~/Desktop/VideosFolder/TutorialFolder/





            share|improve this answer








            New contributor




            gopika is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.





















              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
              });


              }
              });






              MadzQuestioning is a new contributor. Be nice, and check out our Code of Conduct.










              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f512884%2fmv-exclude-folder-not-working%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              You could just run



              mv * TutorialFolder/


              While in VideosFolder/. This will move all files and directories (not starting with a .) into TutorialFolder/. As you can't move a directory into itself, you will likely get a warning message along the lines of



              mv: cannot move 'TutorialFolder' to a subdirectory of itself, 'TutorialFolder/TutorialFolder'


              This is expected and just means that mv hasn't moved TutorialFolder.






              share|improve this answer
























              • This does work but it's gives a warning. I was thinking of a more cleaner way like what if I want to exclude 2 folder or more then this solution will not fix it. I was really hoping to get an answer about extglob approach as this is more flexible

                – MadzQuestioning
                2 hours ago
















              1














              You could just run



              mv * TutorialFolder/


              While in VideosFolder/. This will move all files and directories (not starting with a .) into TutorialFolder/. As you can't move a directory into itself, you will likely get a warning message along the lines of



              mv: cannot move 'TutorialFolder' to a subdirectory of itself, 'TutorialFolder/TutorialFolder'


              This is expected and just means that mv hasn't moved TutorialFolder.






              share|improve this answer
























              • This does work but it's gives a warning. I was thinking of a more cleaner way like what if I want to exclude 2 folder or more then this solution will not fix it. I was really hoping to get an answer about extglob approach as this is more flexible

                – MadzQuestioning
                2 hours ago














              1












              1








              1







              You could just run



              mv * TutorialFolder/


              While in VideosFolder/. This will move all files and directories (not starting with a .) into TutorialFolder/. As you can't move a directory into itself, you will likely get a warning message along the lines of



              mv: cannot move 'TutorialFolder' to a subdirectory of itself, 'TutorialFolder/TutorialFolder'


              This is expected and just means that mv hasn't moved TutorialFolder.






              share|improve this answer













              You could just run



              mv * TutorialFolder/


              While in VideosFolder/. This will move all files and directories (not starting with a .) into TutorialFolder/. As you can't move a directory into itself, you will likely get a warning message along the lines of



              mv: cannot move 'TutorialFolder' to a subdirectory of itself, 'TutorialFolder/TutorialFolder'


              This is expected and just means that mv hasn't moved TutorialFolder.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered 5 hours ago









              TorinTorin

              47929




              47929













              • This does work but it's gives a warning. I was thinking of a more cleaner way like what if I want to exclude 2 folder or more then this solution will not fix it. I was really hoping to get an answer about extglob approach as this is more flexible

                – MadzQuestioning
                2 hours ago



















              • This does work but it's gives a warning. I was thinking of a more cleaner way like what if I want to exclude 2 folder or more then this solution will not fix it. I was really hoping to get an answer about extglob approach as this is more flexible

                – MadzQuestioning
                2 hours ago

















              This does work but it's gives a warning. I was thinking of a more cleaner way like what if I want to exclude 2 folder or more then this solution will not fix it. I was really hoping to get an answer about extglob approach as this is more flexible

              – MadzQuestioning
              2 hours ago





              This does work but it's gives a warning. I was thinking of a more cleaner way like what if I want to exclude 2 folder or more then this solution will not fix it. I was really hoping to get an answer about extglob approach as this is more flexible

              – MadzQuestioning
              2 hours ago













              0














              The other answer works but this is a cleaner way with no errors:



              find . -maxdepth 1 ! ( -name TutorialFolder -o -name '.' ) -exec mv {} TutorialFolder/ ;


              That will find every file and directory in the current directory where the name is not equal to TutorialFolder and . (which is the current directory itself) and then use -exec to mv them into TutorialFolder.






              share|improve this answer




























                0














                The other answer works but this is a cleaner way with no errors:



                find . -maxdepth 1 ! ( -name TutorialFolder -o -name '.' ) -exec mv {} TutorialFolder/ ;


                That will find every file and directory in the current directory where the name is not equal to TutorialFolder and . (which is the current directory itself) and then use -exec to mv them into TutorialFolder.






                share|improve this answer


























                  0












                  0








                  0







                  The other answer works but this is a cleaner way with no errors:



                  find . -maxdepth 1 ! ( -name TutorialFolder -o -name '.' ) -exec mv {} TutorialFolder/ ;


                  That will find every file and directory in the current directory where the name is not equal to TutorialFolder and . (which is the current directory itself) and then use -exec to mv them into TutorialFolder.






                  share|improve this answer













                  The other answer works but this is a cleaner way with no errors:



                  find . -maxdepth 1 ! ( -name TutorialFolder -o -name '.' ) -exec mv {} TutorialFolder/ ;


                  That will find every file and directory in the current directory where the name is not equal to TutorialFolder and . (which is the current directory itself) and then use -exec to mv them into TutorialFolder.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 4 hours ago









                  Nasir RileyNasir Riley

                  3,0722410




                  3,0722410























                      0














                      You can try Rsync command.Rsync is a fast and versatile command line utility that synchronizes files and folders between two locations over a remote shell.



                       rsync -a --exclude 'TutorialFolder' ~/Desktop/VideosFolder/  ~/Desktop/VideosFolder/TutorialFolder/





                      share|improve this answer








                      New contributor




                      gopika is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.

























                        0














                        You can try Rsync command.Rsync is a fast and versatile command line utility that synchronizes files and folders between two locations over a remote shell.



                         rsync -a --exclude 'TutorialFolder' ~/Desktop/VideosFolder/  ~/Desktop/VideosFolder/TutorialFolder/





                        share|improve this answer








                        New contributor




                        gopika is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.























                          0












                          0








                          0







                          You can try Rsync command.Rsync is a fast and versatile command line utility that synchronizes files and folders between two locations over a remote shell.



                           rsync -a --exclude 'TutorialFolder' ~/Desktop/VideosFolder/  ~/Desktop/VideosFolder/TutorialFolder/





                          share|improve this answer








                          New contributor




                          gopika is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.










                          You can try Rsync command.Rsync is a fast and versatile command line utility that synchronizes files and folders between two locations over a remote shell.



                           rsync -a --exclude 'TutorialFolder' ~/Desktop/VideosFolder/  ~/Desktop/VideosFolder/TutorialFolder/






                          share|improve this answer








                          New contributor




                          gopika is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          share|improve this answer



                          share|improve this answer






                          New contributor




                          gopika is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          answered 27 mins ago









                          gopikagopika

                          1




                          1




                          New contributor




                          gopika is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.





                          New contributor





                          gopika is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.






                          gopika is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.






















                              MadzQuestioning is a new contributor. Be nice, and check out our Code of Conduct.










                              draft saved

                              draft discarded


















                              MadzQuestioning is a new contributor. Be nice, and check out our Code of Conduct.













                              MadzQuestioning is a new contributor. Be nice, and check out our Code of Conduct.












                              MadzQuestioning is a new contributor. Be nice, and check out our Code of Conduct.
















                              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%2f512884%2fmv-exclude-folder-not-working%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

                              Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

                              Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

                              Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...