Please Help!
I have data containing wav, txt and different type of files on server A and i'm trying to write a script to copy these files in server B, C and D but each type of files goes to different directories on those server for eg. txt files goes to Text directory and wav goes to music directory and so on. But before copying over I wish to back up the files if the file in server A already existed in server B,C and D
The servers are mirror to each other. I tried to get started but then then i got stuck when trying to copy multiple files resulted from ls
#!/bin/sh
#### I am now in server A ######
echo "what directory where your store your files?"
read dir
varA=`ls $dir`
array=(serverB serverC serverD)
for index in array
do
ssh array[index]
echo "$PWD"
for file in $varA; do
case $file in
*.wav)
cd /root/music/Mymusic/ | cp $varA $varA$.bak
##stuck##