folder_name="cad_exp_1_results"

if [ -d "$folder_name" ]; then
  echo "Folder '$folder_name' already exists. Emptying it..."
  rm -r "$folder_name"/*
else
  echo "Creating folder '$folder_name'..."
  mkdir "$folder_name"
fi

while true; do
    list=($(kubectl get pods --namespace tfs | grep l3-centralized | awk '{print $1}'))
    #kubectl -n "tfs" cp $pod_name:exp_1.csv $folder_name/$pod_name.csv -c server
    echo "These are the pods for now"
    for item in "${list[@]}"; do
        echo $item
        kubectl -n "tfs" cp $item:cad_metrics.csv $folder_name/$item.csv -c server
    done
    sleep 2
done

# kubectl get pods --namespace tfs | grep l3-centralized | wc -l
# kubectl --namespace tfs get all | grep autoscaling/l3-centralizedattackdetectorservice-hpa  | awk '{print $3}'