I have two shell scripts for synchronising data with the remore, one called out.sh
which is supposed to sync local data to the remote and the other called in.sh
which is supposed to sync the local data from the remote.
out.sh
reads the command
rsync -azEX \
--itemize-changes \
--info=BACKUP1,DEL1,NAME1,REMOVE1 \
--delete \
--exclude-from=$EXCLUDE_FILE \
$BCK_SRC $SSH_BCK_DST
in.sh
reads the command
rsync -azEX \
--itemize-changes \
--info=BACKUP1,DEL1,NAME1,REMOVE1 \
--delete \
--exclude-from=$EXCLUDE_FILE \
$SSH_BCK_SRC $BCK_DST
The exclude file is:
+ /dir1/***
+ /dir2/***
+ /dir3/***
- /***
When I make changes on the local in some file in dir1
, and then run out.sh
, nothing is copied over, however, in.sh
copies over the old file from the remote. It should not I think. But more important is that out.sh
does nothing. When I delete the last line in the exclude file, then out.sh
copies over the files as expected.
Question 1: How to make the exclude file correctly, so that it only syncs the contents of the directories after the + sign and nothing else.
Question 2: Is the behaviour that in.sh
copies older files over the newer files correct?