Announcement

Collapse
No announcement yet.

rsync exclude problem

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    rsync exclude problem

    I want to backup all my files in 'home' excluding several folders.
    Code:
    sudo rsync -av --delete /home/bill/ /media/mycloud/Ubuntu/dell19 --exclude=.thunderbird --exclude=/home/bill/.cach --exclude=/home/bill/.mozilla
    This seems to exclude the first folder (.thunderbird) but not the following two.
    Any advice is welcome

    Kubuntu 18.04.3
    Last edited by Snowhog; Sep 17, 2019, 07:32 AM. Reason: Correct spelling in Title

    #2
    Take a look here: https://askubuntu.com/questions/3204...ies-with-rsync
    Using Kubuntu Linux since March 23, 2007
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

    Comment


      #3
      Originally posted by bill-lancaster View Post
      --exclude=/home/bill/.cach
      That looks wrong, did you really run that?
      Regards, John Little

      Comment


        #4
        In short, don't use absolute paths in PATTERN, as it's interpreted to mean the source dir root, not file hierarchy root:
        you'll probably want:
        Code:
        sudo rsync -av --delete --exclude='/.thunderbird' --exclude='/.cache' --exclude='/.mozilla' /home/bill/ /media/mycloud/Ubuntu/dell19
        Note "cache" as pointed out by jlittle, and I've included a leading "/" for exact matches for the first level sub-directories to be excluded, otherwise the exclude rule will also match /home/bill/[any]/[path]/.thunderbird etc. (unlikely to exist in this case, but possible with other PATTERNs), also added quotes so it will also work with possible white spaces in PATTERNs etc.
        Last edited by kubicle; Sep 17, 2019, 02:58 AM.

        Comment


          #5
          this is what I used to back up my system one time ,,,

          Code:
          vinny@vinny-Bonobo-Extreme:~$ sudo rsync -aAXvh --progress /mnt/sda6/ --exclude={/cdrom,/dev,/lost+found,/media,/proc,/run,/sys,/tmp} /mnt/sdb1/backup
          the thread hear https://www.kubuntuforums.net/showth...-options/page2

          VINNY
          i7 4core HT 8MB L3 2.9GHz
          16GB RAM
          Nvidia GTX 860M 4GB RAM 1152 cuda cores

          Comment


            #6
            Originally posted by vinnywright View Post
            Code:
             --exclude={/cdrom,/dev,/lost+found,/media,/proc,/run,/sys,/tmp}
            The brace expansion will work in shells like bash or zsh, but isn't shellproof (fails on sh and dash), so you'll need to be careful when using it in scripts (or make sure your script is running on a shell that supports it, as /bin/sh is still dash in *buntus)...using separate exclude rules (or an exclude file with "--exclude-from=[file]" ) will work in any shell.
            Last edited by kubicle; Sep 17, 2019, 10:59 PM.

            Comment


              #7
              Originally posted by kubicle View Post
              The brace expansion will work in shells like bash or zsh, but isn't shellproof (fails on sh and dash), so you'll need to be careful when using it in scripts (or make sure your script is running on a shell that supports it, as /bin/sh is still dash in *buntus)...using separate exclude rules (or an exclude file with "--exclude-from=[file]" ) will work in any shell.
              thanks for the heads up .
              I do not know a lot about shell expansion or rsync , I just needed to pack-up my system just in case and do a release upgrade , that did go a little sideways but I managed to work it out and the rsync backup was not needed and has since been deleted.

              VINNY
              i7 4core HT 8MB L3 2.9GHz
              16GB RAM
              Nvidia GTX 860M 4GB RAM 1152 cuda cores

              Comment

              Working...
              X