Scp over ssh to multiple servers using bash script

Hi All,

I have a requirement like, i need to copy a latest file from a directory which is on remote server to my local machine . In the same way how we can implement this using shell script.
i mean, every day one report will be generated to a directory in remote servers, i need to write a script to pick latest report file from multiple servers and place them into my local server.

You can use “rsync” for this;

rsync --rsh=‘sshpass -p “password" ssh -p PORT -l USER’ --progress IP:/home/user/file.tar.gz your_folder/

but of course, you need to create the script and record the cron.