SSH Transfer Files Using tar
tar can be used to fast transfer files between two Ubuntu servers.
Push Directory from Server A to Server B (same path)
$[path]$
$[b_hostname]$
$[job]$
The following files/directories in Server A will be excluded:
sudo tar -c $path$ | ssh $b_hostname$ 'sudo tar -xvf - -C /'
parallel by directories (same path)
sudo apt install parallel
find $path$ -type d -maxdepth 1 | parallel --will-cite --dry-run -j $job$ sudo tar -c {} \| ssh $b_hostname$ 'sudo tar -xvf - -C /'
find $path$ -type d -maxdepth 1 | parallel --will-cite -j $job$ sudo tar -c {} \| ssh $b_hostname$ 'sudo tar -xvf - -C {} -C /'
不需要
find $path$ -type d -maxdepth 1 | parallel --will-cite -j $job$ ssh $b_hostname$ 'sudo mkdir -p {}'