Results 1 to 6 of 6

Thread: rsync not working with --include-from option.

  1. #1
    Join Date
    Aug 2010
    Location
    INDIA
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    rsync not working with --include-from option.

    I am trying to add folder locations to a simple txt file so that rsync can create my backup. But when I am running --dry-run its not showing any file transfer.

    Code:
    $ rsync -avrh --dry-run --progress --include-from=/home/tarun/.backup_scripts/include_files.txt /home/tarun/b_test/destination/
    sending incremental file list
    drwxrwxr-x        4096 2014/02/11 22:26:47 .
    
    
    sent 41 bytes  received 12 bytes  106.00 bytes/sec
    total size is 0  speedup is 0.00 (DRY RUN)
    include.txt file:
    Code:
    $ cat include_files.txt 
    + /home/tarun/b_test/source
    source and destination folder contents.
    Code:
    $ ls *
    destination:
    
    
    source:
    abs-guide.pdf  C++ By its Creator.pdf  file.txt  testDir  videoplayback_002

  2. #2
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: rsync not working with --include-from option.

    I'm using rsync too, but I have not used --include-from=...

    Have you tried without the plus sign at the beginning of the line in the file?

    Maybe you have better luck with --files-from=...

    See
    Code:
    man rsync

  3. #3
    Join Date
    Feb 2008
    Location
    Pelican Bay Correctional
    Beans
    Hidden!

    Re: rsync not working with --include-from option.

    In my experience, both include-from and exclude-from files are just straight textual listings of absolute paths.
    What's a landing but a take off in reverse?

  4. #4
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    1,682

    Re: rsync not working with --include-from option.

    I experimented with this in the past, but don't use it. I recall that the files in the list must have paths relative to the source folder and be no higher than the source folder.

    Code:
    rsync -ti --files-from=filelist source destination

  5. #5
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    1,682

    Re: rsync not working with --include-from option.

    Just ran a little test. Works as advertised.

    Code:
    folder and file structure
    -------------------------
    rsync-testing
    folder1
    --folder3
    ----file5
    --file1
    --file2
    folder2
    file3
    file4
    filelist
    
    dn@Sydney:~/work/rsync-testing$ rsync -nti --files-from=filelist /home/dn/work/rsync-testing/ /home/dn/work/rsync-testing/folder2/
    >f+++++++++ file3
    >f+++++++++ file4
    cd+++++++++ folder1/
    >f+++++++++ folder1/file1
    cd+++++++++ folder1/folder3/
    >f+++++++++ folder1/folder3/file5
    filelist lists all files except file2
    Last edited by Dennis N; February 12th, 2014 at 06:08 PM.

  6. #6
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    6,906
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: rsync not working with --include-from option.

    Hi c2tarun.

    The '--include-from' option is used to list rsync's 'filter rules'. In order to include only one subdirectory (e.g. /home/tarun/b_test/source/), all its contents (all recursive tree), and nothing else, you need several rules. Something like this:
    Code:
    + /home/
    + /home/tarun/
    + /home/tarun/b_test/
    + /home/tarun/b_test/source/
    + /home/tarun/b_test/source/**
    - *
    However note that this rules must be relative to the path being read by rsync. If you run your rsync command from your home, you may simplify the rules to something like this:
    Code:
    + b_test/
    + b_test/source/
    + b_test/source/**
    - *
    In any case, you need both source and destination in your command:
    Code:
    rsync -avrh --dry-run --progress --include-from=.backup_scripts/include_files.txt  b_test/ destination/
    Hope it helps. Let us know how it goes.
    Regards.
    Last edited by papibe; February 13th, 2014 at 12:27 AM. Reason: spelling and bold source and dest.

Bookmarks

Posting Permissions

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