I'm using below command to transfer files cross server
scp -rc blowfish /source/directory/* [email protected]:/destination/directory
Is there a way to transfer only files modified files just like update
command for cp
?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this communityI'm using below command to transfer files cross server
scp -rc blowfish /source/directory/* [email protected]:/destination/directory
Is there a way to transfer only files modified files just like update
command for cp
?
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.
--delete
, since visitors on a stale page might request an asset that no longer exists.
rsync
but have scp
. Is there a comparable solution, even if it needs a few lines of scripting?
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