Download from multiple servers using SCP

Script allow you to download from multiple servers using SCP protocol and sshpass to send password for authentication. Files will be stored in different directory with hostname.

Requires an input file with format HostName:IP:Pass

if [ -e “input.txt” ]; then
while read i; do
mkdir “$(echo $i | cut -d: -f 1)”
echo “$(echo $i | cut -d: -f 3)” > pass.txt
sshpass -f “pass.txt” scp -o StrictHostkeyChecking=no user@”$(echo $i | cut -d: -f 2)”:/tmp/*sample “./$(echo $i|cut -d: -f 1)”
done < input.txt
fi

rm pass.txt