Search code examples
linuxrsync

rsync --exclude not excluding specific files


I am currently running an rsync command to backup my specific folder.

Here is the command:

rsync -rtzv -e --exclude "generator/" --exclude "workspace/gallery/server/lib/personas_constants.php"  /home/brandon/workspace/gallery /home/brandon/workspace/gallery2

The issue I am having is the --exclude is not excluding the specific files. It is the relative path to the files from where I am running the rsync command. The exclude does however work for the "generator/" directory.

Can someone shine some light on this for me?


Solution

  • It turned out that it is the relative path from the folders that are being rsync'd with one another. Not from where you are running the rsync command.

    --exclude "generator/" --exclude "server/lib/personas_constants.php" --exclude "server/lib/connect.php" 
    

    Fixed my issues.