mirror of
https://github.com/namibia/demo-sync.git
synced 2024-11-22 03:25:09 +00:00
Improved the exclude option.
This commit is contained in:
parent
081d5b2456
commit
c5579f5e5a
4
sync.sh
4
sync.sh
@ -483,7 +483,7 @@ function syncFolder() {
|
|||||||
# make tmp dir
|
# make tmp dir
|
||||||
mkdir "$tmpPath"
|
mkdir "$tmpPath"
|
||||||
# move file/folders out to tmp folder
|
# move file/folders out to tmp folder
|
||||||
for line in $(cat ${EXCLUDEPATH}${HASH}); do mv -f $target_folder/$line $tmpPath; done
|
for line in $(cat ${EXCLUDEPATH}${HASH}); do line=$(echo $line | sed $'s/\r//'); mv -f $target_folder/$line $tmpPath; done
|
||||||
fi
|
fi
|
||||||
# we use rsync to do all the sync work (very smart)
|
# we use rsync to do all the sync work (very smart)
|
||||||
rsync -qrd --delete "${source_folder}/" "${target_folder}"
|
rsync -qrd --delete "${source_folder}/" "${target_folder}"
|
||||||
@ -501,7 +501,7 @@ function syncFolder() {
|
|||||||
# move the files back
|
# move the files back
|
||||||
if [ -f "${EXCLUDEPATH}${HASH}" ]; then
|
if [ -f "${EXCLUDEPATH}${HASH}" ]; then
|
||||||
# move file/folders out
|
# move file/folders out
|
||||||
for line in $(cat ${EXCLUDEPATH}${HASH}); do mv -f $tmpPath/$line $target_folder; done
|
for line in $(cat ${EXCLUDEPATH}${HASH}); do line=$(echo $line | sed $'s/\r//'); mv -f $tmpPath/$line $target_folder; done
|
||||||
# remove tmp dir
|
# remove tmp dir
|
||||||
rm -r "$tmpPath"
|
rm -r "$tmpPath"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user