excluding hidden files only in a particular directory

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








up vote
1
down vote

favorite
1












I’m trying to synchronise my home folder with a usb disk.



I would like to ignore the hidden files and directory in my home folder but only in this directory, I still need to synchronise the hidden files in the sub-directories contained in my home folder.



I tried to use this option : --exclude="/home/valentin/.*" --exclude "/home/valentin/.*/" but rsync synchronises everything, even /home/valentin/.cache/ for example



What option do I need to use ?










share|improve this question

























    up vote
    1
    down vote

    favorite
    1












    I’m trying to synchronise my home folder with a usb disk.



    I would like to ignore the hidden files and directory in my home folder but only in this directory, I still need to synchronise the hidden files in the sub-directories contained in my home folder.



    I tried to use this option : --exclude="/home/valentin/.*" --exclude "/home/valentin/.*/" but rsync synchronises everything, even /home/valentin/.cache/ for example



    What option do I need to use ?










    share|improve this question























      up vote
      1
      down vote

      favorite
      1









      up vote
      1
      down vote

      favorite
      1






      1





      I’m trying to synchronise my home folder with a usb disk.



      I would like to ignore the hidden files and directory in my home folder but only in this directory, I still need to synchronise the hidden files in the sub-directories contained in my home folder.



      I tried to use this option : --exclude="/home/valentin/.*" --exclude "/home/valentin/.*/" but rsync synchronises everything, even /home/valentin/.cache/ for example



      What option do I need to use ?










      share|improve this question













      I’m trying to synchronise my home folder with a usb disk.



      I would like to ignore the hidden files and directory in my home folder but only in this directory, I still need to synchronise the hidden files in the sub-directories contained in my home folder.



      I tried to use this option : --exclude="/home/valentin/.*" --exclude "/home/valentin/.*/" but rsync synchronises everything, even /home/valentin/.cache/ for example



      What option do I need to use ?







      rsync






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 21 at 16:13









      Albizia

      437




      437




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          Use below command.



          rsync -avz --exclude '/.*' /home/valentin/ /destination_folder





          share|improve this answer



























            up vote
            0
            down vote













            The path rsync uses for --exclude is relative to the /source



            rsync -avz --exclude '.*' ~ /destination


            should do the trick.






            share|improve this answer




















            • This will exclude all hidden files
              – dedunumax
              Mar 21 at 17:05










            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "89"
            ;
            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: true,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1017991%2fexcluding-hidden-files-only-in-a-particular-directory%23new-answer', 'question_page');

            );

            Post as a guest






























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote



            accepted










            Use below command.



            rsync -avz --exclude '/.*' /home/valentin/ /destination_folder





            share|improve this answer
























              up vote
              2
              down vote



              accepted










              Use below command.



              rsync -avz --exclude '/.*' /home/valentin/ /destination_folder





              share|improve this answer






















                up vote
                2
                down vote



                accepted







                up vote
                2
                down vote



                accepted






                Use below command.



                rsync -avz --exclude '/.*' /home/valentin/ /destination_folder





                share|improve this answer












                Use below command.



                rsync -avz --exclude '/.*' /home/valentin/ /destination_folder






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 21 at 17:04









                dedunumax

                4,26021526




                4,26021526






















                    up vote
                    0
                    down vote













                    The path rsync uses for --exclude is relative to the /source



                    rsync -avz --exclude '.*' ~ /destination


                    should do the trick.






                    share|improve this answer




















                    • This will exclude all hidden files
                      – dedunumax
                      Mar 21 at 17:05














                    up vote
                    0
                    down vote













                    The path rsync uses for --exclude is relative to the /source



                    rsync -avz --exclude '.*' ~ /destination


                    should do the trick.






                    share|improve this answer




















                    • This will exclude all hidden files
                      – dedunumax
                      Mar 21 at 17:05












                    up vote
                    0
                    down vote










                    up vote
                    0
                    down vote









                    The path rsync uses for --exclude is relative to the /source



                    rsync -avz --exclude '.*' ~ /destination


                    should do the trick.






                    share|improve this answer












                    The path rsync uses for --exclude is relative to the /source



                    rsync -avz --exclude '.*' ~ /destination


                    should do the trick.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Mar 21 at 16:44









                    variona

                    1149




                    1149











                    • This will exclude all hidden files
                      – dedunumax
                      Mar 21 at 17:05
















                    • This will exclude all hidden files
                      – dedunumax
                      Mar 21 at 17:05















                    This will exclude all hidden files
                    – dedunumax
                    Mar 21 at 17:05




                    This will exclude all hidden files
                    – dedunumax
                    Mar 21 at 17:05

















                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1017991%2fexcluding-hidden-files-only-in-a-particular-directory%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    Trouble downloading packages list due to a “Hash sum mismatch” error

                    How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

                    Cutting all the characters after the last /