Announcement

Collapse
No announcement yet.

Help needed with rsync

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

    Help needed with rsync

    The following code:-
    Code:
    sudo rsync -av --exclude={'/home/bill/.DeletedFiles/*,/home/bill/.cache/*,/home/bill/.Trash-1000/*'} /home/bill/ /media/mycloud/Public/compaq
    ​
    Copies the named excluded files regardless.

    Where am I going wrong?
    Last edited by bill-lancaster; Jan 11, 2023, 10:58 AM.

    #2
    I think the syntax should be:
    Code:
    sudo rsync -av --exclude={'/home/bill/.DeletedFiles/*','/home/bill/.cache/*','/home/bill/.Trash-1000/*'} /home/bill/ /media/mycloud/Public/compaq
    You have left out some ' between the { }, if I am correct.
    Last edited by Schwarzer Kater; Jan 11, 2023, 01:35 PM.
    Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
    Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

    get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
    install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

    Comment


      #3
      Thank you for the response. Yes, each folder needs to be inside '......', but I still have the same problem.

      Code:
      rsync -av --exclude={'~/.DeletedFiles','~/.cache','~/.Trash-1000'} /home/bill/ /media/mycloud/Public/compaq3
      ​
      The contents of the excluded files are being copied.

      I believe that --exclude '~/.cache' should skip copying that folder completely but --exclude '~/.cache/*' will copy the folder but not the contents.

      Comment


        #4
        Success! --exclude item paths are relative, so:-
        Code:
        --exclude={'.DeletedFiles,'.cache'}
        Works fine,

        thanks

        Comment


          #5
          Originally posted by bill-lancaster View Post
          Code:
          rsync -av --exclude={'~/.DeletedFiles','~/.cache','~/.Trash-1000'} /home/bill/ /media/mycloud/Public/compaq3
          ​
          The "~" construct for your $HOME is "substituted by your shell" (from the rsync man page), and by quoting it you've turned off that shell expansion.

          Regards, John Little

          Comment


          • oshunluvr
            oshunluvr commented
            Editing a comment
            Good catch!
        Working...
        X