I'm using following command to transfer file using rsync
to only one connected host:
rsync -az -e ssh /path/to/source 192.168.8.8:/path/to/destination
This is the case of static ip addesss. But in other case there are more than one system connected using DHCP.
I've tried:
rsync -az -e ssh /path/to/source 192.168.8.*:/path/to/destination
But it shows an error
ssh: could not resolve the hostname 192.168.8.*: Name or service not known
Wildcards and the simple regex (e.g.
ls /usr/bin/x[bc]*
) only work on the local filesystem.Wildcards cannot know, which remote host you want copy the folders to. You need a loop for that:
This will copy the
source
to all host from 192.168.8.8 to 192.168.8.18.rsync
can only copy to one destination at a time, likessh
can only connect to one destination per invocation.However, you may want to have a look at the package pssh (for Parallel SSH), which also provides parallel rsync: