I'm having issues trying to write a script that will move and rename multiple directories. Each directory represents a user from a specific server, therefore, the same user can have multiple folders e.g. 12345678_sv1
, 12345678_sv2
.
I'd like to move specific users from "All" directory to a consolidated one. For example:
All/12345678_sv1 & sv2 >>> Consolidated/12345678
I tried the following:
#!/bin/bash
User_List=`cat ./User_List.txt`
Destination_List=`cat ./Destination_List.txt`
for i in $User_List
do
echo "Name of User: $i "
echo
echo
echo "Copying $i User to new destination"
echo
echo
cp -R $i /Consolidated/$Destination_List
echo
echo
echo "Moved $i to $Destination_List"
echo
echo
done
However, the folders stop getting copied after the first user. Any assistance would be greatly appreciated.