I am working on a backup script but got some problems with my script, can you help me?


    rsync \
      --archive \
      --recursive \
      --include-from $INCLUDE \
      --exclude-from $EXCLUDE \
      --hard-links \
      --perms \
      --executability \
      --owner \
      --group \
      --human-readable \
      --verbose \
      --progress \
      --delete-before \
      --stats \
      --timeout=300 \
      -e "ssh -i $SSHKEY" $USER@$IP:$DST

My question is, how do I tell rsync to rsync everything thats in the include-file , exclude everything thats in the exclude-file without giving him a source path?


The manual says you have to have a source directory.

You should use the list in your include file as a list of source directories to loop through and rsync from:

for dir in /root /data /etc/httpd
    rsync OPTIONS $dir DEST

Or, you can make / your source directory, and have something like /* in your exclude pattern.

  • Thank you very much! – xDuckyDuc Jul 10 '19 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.