include dot files (.x) with rsync -r command

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











up vote
1
down vote

favorite












I have the following command:



rsync -r --exclude="node_modules" "/r2g_shared_dir/vamoot"/* "/home/node/.docker_r2g_cache/b640e7fd-27a7-4dd8-8ca8-5363a1c59c35"


I just realized that using /* will not copy over dot files (files/folders that start with .)...



Anybody know how I can include those files?



I assume the best way would be to forgo the /* notation and just use



rsync -r --exclude="node_modules" "/r2g_shared_dir/vamoot" "/home/node/.docker_r2g_cache/b640e7fd-27a7-4dd8-8ca8-5363a1c59c35"


but is there another way?







share|improve this question























    up vote
    1
    down vote

    favorite












    I have the following command:



    rsync -r --exclude="node_modules" "/r2g_shared_dir/vamoot"/* "/home/node/.docker_r2g_cache/b640e7fd-27a7-4dd8-8ca8-5363a1c59c35"


    I just realized that using /* will not copy over dot files (files/folders that start with .)...



    Anybody know how I can include those files?



    I assume the best way would be to forgo the /* notation and just use



    rsync -r --exclude="node_modules" "/r2g_shared_dir/vamoot" "/home/node/.docker_r2g_cache/b640e7fd-27a7-4dd8-8ca8-5363a1c59c35"


    but is there another way?







    share|improve this question





















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have the following command:



      rsync -r --exclude="node_modules" "/r2g_shared_dir/vamoot"/* "/home/node/.docker_r2g_cache/b640e7fd-27a7-4dd8-8ca8-5363a1c59c35"


      I just realized that using /* will not copy over dot files (files/folders that start with .)...



      Anybody know how I can include those files?



      I assume the best way would be to forgo the /* notation and just use



      rsync -r --exclude="node_modules" "/r2g_shared_dir/vamoot" "/home/node/.docker_r2g_cache/b640e7fd-27a7-4dd8-8ca8-5363a1c59c35"


      but is there another way?







      share|improve this question











      I have the following command:



      rsync -r --exclude="node_modules" "/r2g_shared_dir/vamoot"/* "/home/node/.docker_r2g_cache/b640e7fd-27a7-4dd8-8ca8-5363a1c59c35"


      I just realized that using /* will not copy over dot files (files/folders that start with .)...



      Anybody know how I can include those files?



      I assume the best way would be to forgo the /* notation and just use



      rsync -r --exclude="node_modules" "/r2g_shared_dir/vamoot" "/home/node/.docker_r2g_cache/b640e7fd-27a7-4dd8-8ca8-5363a1c59c35"


      but is there another way?









      share|improve this question










      share|improve this question




      share|improve this question









      asked May 27 at 20:51









      Alexander Mills

      1,878929




      1,878929




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          If this is bash you can just set dotglob:



          shopt -s dotglob


          This does not match . or .. (in contrast to .*).



          So the same command could be used:



          rsync -r --exclude="node_modules" "/r2g_shared_dir/vamoot"/* ...





          share|improve this answer























          • So I would do: rsync -r "/r2g_shared_dir/vamoot"/.* ??
            – Alexander Mills
            May 27 at 21:09










          • @AlexanderMills No, see the edit. Sorry, I thought that was obvious.
            – Hauke Laging
            May 27 at 21:24










          • ah sorry now I get it
            – Alexander Mills
            May 27 at 21:25






          • 1




            It would be better to simply leave out the * in the rsync command, but include the slash, otherwise the vamoot directory is also trasferred in the path: rsync -r "/r2g_shared_dir/vamoot"/ ....
            – wurtel
            May 28 at 14:48










          • @wurtel It might be more useful to make that an answer.
            – Hauke Laging
            May 28 at 17:21

















          up vote
          0
          down vote













          It's best to leave the pattern matching to rsync, then you're not depending on whatever shell and options that shell has at that time.



          When you do:



          rsync -a /some/dir/* host:/remote/dir/


          then you're actually asking the shell to expand the /some/dir/* part, so that rsync is actually executed like this:



          rsync -a /some/dir/adir /some/dir/afile /some/dir/anotherfile [etc] host:/remote/dir/


          This is usually quite similar to what the intention was, however not always as demonstrated by the fact that this question was asked. Hence it's better to execute:



          rsync -a /some/dir/ host:/remote/dir/


          Now rsync will (because -a is shorthand for -rlptgoD which includes -r for recursion) recursively walk through the /some/dir directory and sync all its contents to /remote/dir on the remote host, including any dot files directly in /some/dir.



          As the source path ends with a slash /, the filenames transferred omit any part of the source location. If /some/dir was passed, then you're telling to explicitly sync the dir directory, including its name. It's recommended to get into the habit of adding the last slash at all times to avoid such confusion, unless you really understand what's going on.






          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',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            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%2funix.stackexchange.com%2fquestions%2f446348%2finclude-dot-files-x-with-rsync-r-command%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
            1
            down vote



            accepted










            If this is bash you can just set dotglob:



            shopt -s dotglob


            This does not match . or .. (in contrast to .*).



            So the same command could be used:



            rsync -r --exclude="node_modules" "/r2g_shared_dir/vamoot"/* ...





            share|improve this answer























            • So I would do: rsync -r "/r2g_shared_dir/vamoot"/.* ??
              – Alexander Mills
              May 27 at 21:09










            • @AlexanderMills No, see the edit. Sorry, I thought that was obvious.
              – Hauke Laging
              May 27 at 21:24










            • ah sorry now I get it
              – Alexander Mills
              May 27 at 21:25






            • 1




              It would be better to simply leave out the * in the rsync command, but include the slash, otherwise the vamoot directory is also trasferred in the path: rsync -r "/r2g_shared_dir/vamoot"/ ....
              – wurtel
              May 28 at 14:48










            • @wurtel It might be more useful to make that an answer.
              – Hauke Laging
              May 28 at 17:21














            up vote
            1
            down vote



            accepted










            If this is bash you can just set dotglob:



            shopt -s dotglob


            This does not match . or .. (in contrast to .*).



            So the same command could be used:



            rsync -r --exclude="node_modules" "/r2g_shared_dir/vamoot"/* ...





            share|improve this answer























            • So I would do: rsync -r "/r2g_shared_dir/vamoot"/.* ??
              – Alexander Mills
              May 27 at 21:09










            • @AlexanderMills No, see the edit. Sorry, I thought that was obvious.
              – Hauke Laging
              May 27 at 21:24










            • ah sorry now I get it
              – Alexander Mills
              May 27 at 21:25






            • 1




              It would be better to simply leave out the * in the rsync command, but include the slash, otherwise the vamoot directory is also trasferred in the path: rsync -r "/r2g_shared_dir/vamoot"/ ....
              – wurtel
              May 28 at 14:48










            • @wurtel It might be more useful to make that an answer.
              – Hauke Laging
              May 28 at 17:21












            up vote
            1
            down vote



            accepted







            up vote
            1
            down vote



            accepted






            If this is bash you can just set dotglob:



            shopt -s dotglob


            This does not match . or .. (in contrast to .*).



            So the same command could be used:



            rsync -r --exclude="node_modules" "/r2g_shared_dir/vamoot"/* ...





            share|improve this answer















            If this is bash you can just set dotglob:



            shopt -s dotglob


            This does not match . or .. (in contrast to .*).



            So the same command could be used:



            rsync -r --exclude="node_modules" "/r2g_shared_dir/vamoot"/* ...






            share|improve this answer















            share|improve this answer



            share|improve this answer








            edited May 27 at 21:23


























            answered May 27 at 21:06









            Hauke Laging

            53.1k1282130




            53.1k1282130











            • So I would do: rsync -r "/r2g_shared_dir/vamoot"/.* ??
              – Alexander Mills
              May 27 at 21:09










            • @AlexanderMills No, see the edit. Sorry, I thought that was obvious.
              – Hauke Laging
              May 27 at 21:24










            • ah sorry now I get it
              – Alexander Mills
              May 27 at 21:25






            • 1




              It would be better to simply leave out the * in the rsync command, but include the slash, otherwise the vamoot directory is also trasferred in the path: rsync -r "/r2g_shared_dir/vamoot"/ ....
              – wurtel
              May 28 at 14:48










            • @wurtel It might be more useful to make that an answer.
              – Hauke Laging
              May 28 at 17:21
















            • So I would do: rsync -r "/r2g_shared_dir/vamoot"/.* ??
              – Alexander Mills
              May 27 at 21:09










            • @AlexanderMills No, see the edit. Sorry, I thought that was obvious.
              – Hauke Laging
              May 27 at 21:24










            • ah sorry now I get it
              – Alexander Mills
              May 27 at 21:25






            • 1




              It would be better to simply leave out the * in the rsync command, but include the slash, otherwise the vamoot directory is also trasferred in the path: rsync -r "/r2g_shared_dir/vamoot"/ ....
              – wurtel
              May 28 at 14:48










            • @wurtel It might be more useful to make that an answer.
              – Hauke Laging
              May 28 at 17:21















            So I would do: rsync -r "/r2g_shared_dir/vamoot"/.* ??
            – Alexander Mills
            May 27 at 21:09




            So I would do: rsync -r "/r2g_shared_dir/vamoot"/.* ??
            – Alexander Mills
            May 27 at 21:09












            @AlexanderMills No, see the edit. Sorry, I thought that was obvious.
            – Hauke Laging
            May 27 at 21:24




            @AlexanderMills No, see the edit. Sorry, I thought that was obvious.
            – Hauke Laging
            May 27 at 21:24












            ah sorry now I get it
            – Alexander Mills
            May 27 at 21:25




            ah sorry now I get it
            – Alexander Mills
            May 27 at 21:25




            1




            1




            It would be better to simply leave out the * in the rsync command, but include the slash, otherwise the vamoot directory is also trasferred in the path: rsync -r "/r2g_shared_dir/vamoot"/ ....
            – wurtel
            May 28 at 14:48




            It would be better to simply leave out the * in the rsync command, but include the slash, otherwise the vamoot directory is also trasferred in the path: rsync -r "/r2g_shared_dir/vamoot"/ ....
            – wurtel
            May 28 at 14:48












            @wurtel It might be more useful to make that an answer.
            – Hauke Laging
            May 28 at 17:21




            @wurtel It might be more useful to make that an answer.
            – Hauke Laging
            May 28 at 17:21












            up vote
            0
            down vote













            It's best to leave the pattern matching to rsync, then you're not depending on whatever shell and options that shell has at that time.



            When you do:



            rsync -a /some/dir/* host:/remote/dir/


            then you're actually asking the shell to expand the /some/dir/* part, so that rsync is actually executed like this:



            rsync -a /some/dir/adir /some/dir/afile /some/dir/anotherfile [etc] host:/remote/dir/


            This is usually quite similar to what the intention was, however not always as demonstrated by the fact that this question was asked. Hence it's better to execute:



            rsync -a /some/dir/ host:/remote/dir/


            Now rsync will (because -a is shorthand for -rlptgoD which includes -r for recursion) recursively walk through the /some/dir directory and sync all its contents to /remote/dir on the remote host, including any dot files directly in /some/dir.



            As the source path ends with a slash /, the filenames transferred omit any part of the source location. If /some/dir was passed, then you're telling to explicitly sync the dir directory, including its name. It's recommended to get into the habit of adding the last slash at all times to avoid such confusion, unless you really understand what's going on.






            share|improve this answer

























              up vote
              0
              down vote













              It's best to leave the pattern matching to rsync, then you're not depending on whatever shell and options that shell has at that time.



              When you do:



              rsync -a /some/dir/* host:/remote/dir/


              then you're actually asking the shell to expand the /some/dir/* part, so that rsync is actually executed like this:



              rsync -a /some/dir/adir /some/dir/afile /some/dir/anotherfile [etc] host:/remote/dir/


              This is usually quite similar to what the intention was, however not always as demonstrated by the fact that this question was asked. Hence it's better to execute:



              rsync -a /some/dir/ host:/remote/dir/


              Now rsync will (because -a is shorthand for -rlptgoD which includes -r for recursion) recursively walk through the /some/dir directory and sync all its contents to /remote/dir on the remote host, including any dot files directly in /some/dir.



              As the source path ends with a slash /, the filenames transferred omit any part of the source location. If /some/dir was passed, then you're telling to explicitly sync the dir directory, including its name. It's recommended to get into the habit of adding the last slash at all times to avoid such confusion, unless you really understand what's going on.






              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                It's best to leave the pattern matching to rsync, then you're not depending on whatever shell and options that shell has at that time.



                When you do:



                rsync -a /some/dir/* host:/remote/dir/


                then you're actually asking the shell to expand the /some/dir/* part, so that rsync is actually executed like this:



                rsync -a /some/dir/adir /some/dir/afile /some/dir/anotherfile [etc] host:/remote/dir/


                This is usually quite similar to what the intention was, however not always as demonstrated by the fact that this question was asked. Hence it's better to execute:



                rsync -a /some/dir/ host:/remote/dir/


                Now rsync will (because -a is shorthand for -rlptgoD which includes -r for recursion) recursively walk through the /some/dir directory and sync all its contents to /remote/dir on the remote host, including any dot files directly in /some/dir.



                As the source path ends with a slash /, the filenames transferred omit any part of the source location. If /some/dir was passed, then you're telling to explicitly sync the dir directory, including its name. It's recommended to get into the habit of adding the last slash at all times to avoid such confusion, unless you really understand what's going on.






                share|improve this answer













                It's best to leave the pattern matching to rsync, then you're not depending on whatever shell and options that shell has at that time.



                When you do:



                rsync -a /some/dir/* host:/remote/dir/


                then you're actually asking the shell to expand the /some/dir/* part, so that rsync is actually executed like this:



                rsync -a /some/dir/adir /some/dir/afile /some/dir/anotherfile [etc] host:/remote/dir/


                This is usually quite similar to what the intention was, however not always as demonstrated by the fact that this question was asked. Hence it's better to execute:



                rsync -a /some/dir/ host:/remote/dir/


                Now rsync will (because -a is shorthand for -rlptgoD which includes -r for recursion) recursively walk through the /some/dir directory and sync all its contents to /remote/dir on the remote host, including any dot files directly in /some/dir.



                As the source path ends with a slash /, the filenames transferred omit any part of the source location. If /some/dir was passed, then you're telling to explicitly sync the dir directory, including its name. It's recommended to get into the habit of adding the last slash at all times to avoid such confusion, unless you really understand what's going on.







                share|improve this answer













                share|improve this answer



                share|improve this answer











                answered May 29 at 10:25









                wurtel

                8,7151822




                8,7151822






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f446348%2finclude-dot-files-x-with-rsync-r-command%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