Skip to content

Instantly share code, notes, and snippets.

@kebot
Last active December 11, 2015 05:58
Show Gist options
  • Save kebot/4556059 to your computer and use it in GitHub Desktop.
Save kebot/4556059 to your computer and use it in GitHub Desktop.
Make file for rsync, it's a simple dropbox
#
# Makefile for rsync
#
# [help with rsync](http://bbs.chinaunix.net/thread-2116588-1-1.html)
RSYNC_SERVER = <username>@<server>:~/Cloud
LOCAL_FOLDER = ~/Cloud
PARAM = -avz --delete --exclude-from=.rsyncignore
# the safest rsync, did not delete anything
# rsync src dst
rsync:
@echo 'run make push or pull'
push:
@echo "Push will delete files doesn't exists in local"
rsync $(PARAM) $(LOCAL_FOLDER) $(RSYNC_SERVER)/../
# pull from the remote server, also delete
pull:
@echo "Push will delete files doesn't exists in remote server"
rsync $(PARAM) $(RSYNC_SERVER) $(LOCAL_FOLDER)/../
.PHONY: rsync push pull
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment