Find the answer to your Linux question:
Results 1 to 10 of 10
Hello I have a text file which has full path to the files such as cat list.txt /etc/hosts /etc/resolve.conf I would like to incorporate this will rsync to copy/update changes ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2009
    Location
    Toronto
    Posts
    34

    rsync list of files


    Hello

    I have a text file which has full path to the files such as

    cat list.txt

    /etc/hosts
    /etc/resolve.conf

    I would like to incorporate this will rsync to copy/update changes to another directory.

    How can I go about doing that?

    I have tried using the following

    Code:
     rsync -avc `cat list.txt' /backup
    but it doesn't work! can someone help??

    Thank you

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,392
    Code:
    man rsync
    says
    --files-from=FILE

    This should be waht you want.
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    Aug 2009
    Location
    Toronto
    Posts
    34
    I have tried that, but no luck, it keeps complaining about some errors, any other way to do it?

  4. #4
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,392
    --files-from works.

    It would be helpful if you show, what you did and what the error exactly is (in CODE tags plase).
    You must always face the curtain with a bow.

  5. #5
    Just Joined!
    Join Date
    Aug 2009
    Location
    Toronto
    Posts
    34
    if I run the following

    rsync -avnc --files-from=list.txt /tmp

    I get a dump of rsync help options!!

  6. #6
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,392
    ah ok.

    You need to provide a source, even if the files are actually picked from the file list.
    Btw, the man page does show this : The SRC is never optional.

    In your case, /etc might be a good source.
    The filelist then needs to be relative to /etc.

    A source of / is possible, and then you could use absolute paths in your filelist.
    But I wouldnt recommend that.
    A small mistake and you might end up rsyncing your whole system.
    You must always face the curtain with a bow.

  7. #7
    Just Joined!
    Join Date
    Aug 2009
    Location
    Toronto
    Posts
    34
    rsync -avnc --files-from=list.txt /tmp

    it dumps rsync help to the screen and it doesn't sync anything ...

  8. #8
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,392
    As I said.
    You need to
    1) provide a SRC. In the example, I used /etc
    2) adjust your list.txt, so that the files are relative to SRC
    Code:
    rsync -av --files-from=list.txt /etc/ /tmp
    You must always face the curtain with a bow.

  9. #9
    Just Joined!
    Join Date
    Aug 2009
    Location
    Toronto
    Posts
    34
    it worked! you are the man

    it is very tricky, I have to admit , and I had to provide full path for --files-from and source and dest

    Thanks your input ...

    This was one of the error I was running into while I was trying to get it to work.

    root@ubuntu:/tmp# rsync -av --files-from=/root/list.txt /etc/ /tmp
    building file list ... rsync: link_stat "/etc/etc/hosts" failed: No such file or directory (2)
    rsync: link_stat "/etc/etc/resolv.conf" failed: No such file or directory (2)
    done

  10. #10
    Just Joined!
    Join Date
    Aug 2011
    Posts
    11
    root@ubuntu:/tmp# rsync -av --files-from=/root/list.txt /etc/ /tmp
    building file list ... rsync: link_stat "/etc/etc/hosts" failed: No such file or directory (2)
    As Irithori said:

    2) adjust your list.txt, so that the files are relative to SRC
    "/etc/hosts" (which is in your list.txt file) is NOT relative to your source (which is /etc/). All file names starting with "/" are absolute path/file names. You have to replace "/etc/hosts" with "./hosts" or just "hosts" or "../etc/hosts" when using /etc/ as source.

Posting Permissions

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