Sync folder with rsync
Dear All
I have two servers, one for my website(public) and one for testing (localhost). Now I want to use rsync to sync these folders, so that when I update data to testing, it will update to the website automatic. But when I use 'rsync -avz -e ssh --delete /host1/abc host2/abc' , it just sync changes on the files, not delete file. Any ideas about this? please help me!! Thank you so much |
I think you are rsyncing to the wrong place.
You should probably do Code:
rsync -avz -e ssh --delete /host1/abc host2 Code:
rsync -avz -e ssh --delete /host1/abc/ host2/abc PS. Also, have you tried using --delete-excluded? |
Thanks evo2!
I used this command rsync -avz -e ssh --delete --exclude=".*" abc/* host2:/def/ Because I didn't put the same name on the servers. That is the reason? |
I think you can avoid using the wildcard, by using the following form:
Code:
rsync -avz -e ssh --delete abc/ host2:/def The trailing slash has a sort of special meaning in rsync. It is explained in the man page: look for "trailing slash". Cheers, Evo2. |
Thanks evo2, again :)
I used exclude=".*" because I want to sync without hidden files. My local_server is using SVN on 'abc' at localhost, but just wanna update the source to the server, not the svn_files. Do you any ideas about this ? |
I see. In that case I think you can use -C flag (--cvs-exclude) which tries ignore version control system files (cvs, svn, rcs etc).
Code:
rsync -avzC -e ssh --delete abc/ host2:/def |
All times are GMT -5. The time now is 01:12 PM. |