Hi all,
I'm writing a bash script which collects files from several servers into a single folder (e.g. logs). In order to avoid files with the same name but from different servers overriding each other, I want to prepend the server's name before them, e.g.
Code:
scp user@server1:/mylogs/filename.log /targetlogs/server1-filename.log
however, my source filename isn't known in advance, and there may be more than one. i.e. I'm using
Code:
for server in "${SERVERS}" do
eval "scp user@$server:/mylogs/* /targetlogs/$server-<HERE IS WHERE YOUR HELP IS NEEDED>"
done
How can I get the source filename to the target location?
Currently, I'm thinking using a workaround (copy to a tmp folder, rename it there locally, and then move it to its final destination
Thanks!
karnaf