Results 1 to 4 of 4

Thread: Grsync - filtering file types

  1. #1
    Join Date
    Feb 2010
    Location
    Folkestone-on-sea
    Beans
    12
    Distro
    Ubuntu 10.04 Lucid Lynx

    Grsync - filtering file types

    Hi there,

    I've googled around for this for a couple of days and don't seem to be getting anywhere.

    I'm using Grsync and what I want it to do is in essence very simple. I want to be able to plug in any drive into my laptop and run rsync on it to back up all the user documents on there to another external hdd and to exclude everything else. Working on the principle that user documents don't always appear where we'd expect I want rsync to look through the whole drive and filter what it backs up by file type. I am only having partial success, however.

    I am using the 'filter' option in the 'additional options' box. I am using the command
    Code:
    --filter='merge /home/tim/Desktop/filter'
    and I am attaching the filter file I have written. (I have added the .txt extention to upload it).

    I have tested this script on my home folder and here's what's going wrong. Rsync will copy the entire directory structure regardless of whether there are any files to be copied over in those directories. I am also getting only some file types getting included and not others. .odt and .ods files are copied, for instance, but not .doc or .rtf.

    I am scratching my head at this point. Any help is appreciated. I'm not attached to using Grsync so if you have a suggestion or something I can do from the command line, that would work for me too. Thank you so much,

    Tim
    Attached Files Attached Files

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

    Re: Grsync - filtering file types

    The reason docs and rtfs are not being transfer is because there are trailing spaces at the ends of each rules:
    Code:
    ...
    + *.doc
    + *.rtf
    ...
    If you delete the spaces at the end of those lines, it will work. Note that there are several lines with trailing spaces. In order to make the those rules work you'll to remove all the ending spaces.

    BTW, those rules are case insensitive, so it may be necessary to add uppercase rules for old MS Office files. For example
    Code:
    + *.DOC
    + *.XLS
    I hope this helps,
    Regards.
    Last edited by papibe; August 28th, 2011 at 08:25 PM. Reason: spelling

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

    Re: Grsync - filtering file types

    Quote Originally Posted by rockette morton View Post
    Rsync will copy the entire directory structure regardless of whether there are any files to be copied over in those directories.
    Oops, I missed that one.

    To avoid copying empty directories use the 'prune' option:
    Code:
    --prune-empty-dirs
    It will surely work for a first time run. For later syncs, you would need a couple of extra 'delete' options:
    Code:
    --prune-empty-dirs --delete --delete-excluded
    Regards.

  4. #4
    Join Date
    Feb 2010
    Location
    Folkestone-on-sea
    Beans
    12
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Grsync - filtering file types

    gosh - thank you SO much. that is an enormous help to me. and of course i am in awe of your know-how. will do a trial run of this soon and mark as solved. thanks once again!

    tim

Tags for this Thread

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
  •