Can I use rsync to move a list of files in different directories to a remote sever without logging in more than once?

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











up vote
0
down vote

favorite












So, I'm trying to write a script to back up some various configuration files with my ssh fileserver, but I'm not sure the best way to go about this. It would be nice if I could just fill a file with absolute file paths for both machines and directly do this with parallel or something. Parallel has a script that works for an individual directory, but I want to expand this to multiple locations.



For example:



/home/localuser/.bashrc --> remoteuser@remoteIP:/home/remoteuser/backup/.bashrc
/home/localuser/.config/i3/config --> remoteuser@remoteIP:/home/remoteuser/backup/.config/i3/config


for a multitude of files as well as going in the reverse direction if the server actually has a more recent copy.



remoteuser@remoteIP:/home/remoteuser/backup/.bashrc --> /home/localuser/.bashrc


I could effectively do this for one file using these two commands, but I'd have to log in twice.



rsync -vrut -e 'ssh -p portnumber' /home/localuser/.bashrc remoteuser@remoteIP:/home/remoteuser/backup/.bashrc

rsync -vrut -e 'ssh -p portnumber' remoteuser@remoteIP:/home/remoteuser/backup/.bashrc /home/localuser/.bashrc








share

























    up vote
    0
    down vote

    favorite












    So, I'm trying to write a script to back up some various configuration files with my ssh fileserver, but I'm not sure the best way to go about this. It would be nice if I could just fill a file with absolute file paths for both machines and directly do this with parallel or something. Parallel has a script that works for an individual directory, but I want to expand this to multiple locations.



    For example:



    /home/localuser/.bashrc --> remoteuser@remoteIP:/home/remoteuser/backup/.bashrc
    /home/localuser/.config/i3/config --> remoteuser@remoteIP:/home/remoteuser/backup/.config/i3/config


    for a multitude of files as well as going in the reverse direction if the server actually has a more recent copy.



    remoteuser@remoteIP:/home/remoteuser/backup/.bashrc --> /home/localuser/.bashrc


    I could effectively do this for one file using these two commands, but I'd have to log in twice.



    rsync -vrut -e 'ssh -p portnumber' /home/localuser/.bashrc remoteuser@remoteIP:/home/remoteuser/backup/.bashrc

    rsync -vrut -e 'ssh -p portnumber' remoteuser@remoteIP:/home/remoteuser/backup/.bashrc /home/localuser/.bashrc








    share























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      So, I'm trying to write a script to back up some various configuration files with my ssh fileserver, but I'm not sure the best way to go about this. It would be nice if I could just fill a file with absolute file paths for both machines and directly do this with parallel or something. Parallel has a script that works for an individual directory, but I want to expand this to multiple locations.



      For example:



      /home/localuser/.bashrc --> remoteuser@remoteIP:/home/remoteuser/backup/.bashrc
      /home/localuser/.config/i3/config --> remoteuser@remoteIP:/home/remoteuser/backup/.config/i3/config


      for a multitude of files as well as going in the reverse direction if the server actually has a more recent copy.



      remoteuser@remoteIP:/home/remoteuser/backup/.bashrc --> /home/localuser/.bashrc


      I could effectively do this for one file using these two commands, but I'd have to log in twice.



      rsync -vrut -e 'ssh -p portnumber' /home/localuser/.bashrc remoteuser@remoteIP:/home/remoteuser/backup/.bashrc

      rsync -vrut -e 'ssh -p portnumber' remoteuser@remoteIP:/home/remoteuser/backup/.bashrc /home/localuser/.bashrc








      share













      So, I'm trying to write a script to back up some various configuration files with my ssh fileserver, but I'm not sure the best way to go about this. It would be nice if I could just fill a file with absolute file paths for both machines and directly do this with parallel or something. Parallel has a script that works for an individual directory, but I want to expand this to multiple locations.



      For example:



      /home/localuser/.bashrc --> remoteuser@remoteIP:/home/remoteuser/backup/.bashrc
      /home/localuser/.config/i3/config --> remoteuser@remoteIP:/home/remoteuser/backup/.config/i3/config


      for a multitude of files as well as going in the reverse direction if the server actually has a more recent copy.



      remoteuser@remoteIP:/home/remoteuser/backup/.bashrc --> /home/localuser/.bashrc


      I could effectively do this for one file using these two commands, but I'd have to log in twice.



      rsync -vrut -e 'ssh -p portnumber' /home/localuser/.bashrc remoteuser@remoteIP:/home/remoteuser/backup/.bashrc

      rsync -vrut -e 'ssh -p portnumber' remoteuser@remoteIP:/home/remoteuser/backup/.bashrc /home/localuser/.bashrc






      ssh rsync backup remote





      share












      share










      share



      share










      asked 1 min ago









      T. Zack Crawford

      11




      11

























          active

          oldest

          votes











          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%2f475647%2fcan-i-use-rsync-to-move-a-list-of-files-in-different-directories-to-a-remote-sev%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475647%2fcan-i-use-rsync-to-move-a-list-of-files-in-different-directories-to-a-remote-sev%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