Find the answer to your Linux question:
Results 1 to 2 of 2
Hello, I would like to synchronize several files (from separate folders) and different folders to one single directory. It seems too tedious to specify each file and directory in a ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2008
    Posts
    3

    Need help with rsync on local machine


    Hello,

    I would like to synchronize several files (from separate folders) and different folders to one single directory. It seems too tedious to specify each file and directory in a single rsync command, so I was wondering if anyone has a script, where I can simply list the paths to each file and directory I want to sync. And I'm doing this all on a local machine, so I don't need to worry about ssh.

    Thanks,
    Lain

  2. #2
    Just Joined!
    Join Date
    Sep 2007
    Location
    Lafayette, IN
    Posts
    83
    Are you looking for something like this?

    Code:
    #!/bin/csh -f
    
    # Target directory
    set target='/home/myself/target'
    
    # Source directories
    set sources='/home/myself/source1 /home/myself/source2 /usr/local/etc/monkeys'
    
    foreach s ( $sources )
      rsync -av $s $target
    end
    If I understand what you're wanting, that should do the trick. Of course, you can give rsync different options to tweak how it behaves (see `man rsync`)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •