왜 대답이 이미 어딘가에 있기 때문에 나는 이것이 왜 downvoted인지 전혀 알지 못합니다. 어쨌든 나는 충분히 구체적인 질문이라고 생각했다.
여기 몇 시간 후 내 스크립트를 수정 한 방법이 있습니다. 키는 --update
및 --modify-window=1
rsync 명령 옵션에 있습니다.
작동하는 스크립트는 다음과 같습니다 (외부 파일에서 파일을 제외시키고 있음).
#!/bin/sh
ScriptName=${0##*/}
# this script sync SourceFolder with DestinationFolder
# to a FAT32 external drive, excluding files from ExcludeFile
### --- EDIT FOLDERS HERE --- ###
SourceFolder='/Users/matteo'
DestinationFolder='/Volumes/HITACHI/MatteoMainFolderBackup'
ExcludeFile='/Users/matteo/.backupignore'
### --- DISPLAY SOME INFO --- ###
echo "Starting " $ScriptName
printf "WARNING! This script sync all files from SourceFolder to DestinationFolder \n"
echo "SourceFolder: " $SourceFolder
echo "DestinationFolder: " $DestinationFolder
echo "ExcludeFile: " $ExcludeFile
printf "### Start Syncing files ###\n"
### --- OPERATIONS --- ###
rsync --archive \
--delete \
--delete-excluded \
--exclude-from=$ExcludeFile \
--modify-window=1 \
--progress \
--update \
--verbose \
$SourceFolder/ $DestinationFolder
### --- END --- ###
echo $ScriptName " ended"