rsync --exclude not excluding specific files [closed]

和自甴很熟 提交于 2019-12-19 08:32:12

问题


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?


回答1:


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.




回答2:


Personally I've had better luck using an exclude file. It was quite some time ago but it might be worth a shot.




回答3:


The --exclude argument takes a pattern, and file names that match that pattern are excluded - not the specific path to a file.

If you don't have any other files called personas_constants.php, then --exclude personas_constants.php should do the trick - otherwise you'll have to do something fiddly including --exclude-from and moving some files around.



来源:https://stackoverflow.com/questions/8720234/rsync-exclude-not-excluding-specific-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!