SCP transfer only modified files
Solution 1:
rsync
is your friend.
rsync -ru /source/directory/* [email protected]:/destination/directory
If you want it to delete files at the destination that no longer exist at the source, add the --delete
option.
Solution 2:
Generally one asks for scp because there is a reason. I.e. can't install rsyncd on the target.
files=`find . -newermt "-3600 secs"`
for file in $files
do
sshpass -p "" scp "$file" "root@$IP://usr/local/www/current/$file"
done