#!/bin/bash
cd /home/icodex/Dev_Peer-reviewr/InviteAndRefer
current_date=$(date +"%d-%m-%Y")/$(date +"%H-%M-%S")
sudo -S mkdir -p /home/icodex/Dev_Peer-reviewr/Rollback/InviteAndRefer/"$current_date" < /home/icodex/deployment_Scrips/passwd
sudo -S cp -rf /home/icodex/Dev_Peer-reviewr/InviteAndRefer/* /home/icodex/Dev_Peer-reviewr/Rollback/InviteAndRefer/"$current_date" < /home/icodex/deployment_Scrips/passwd
sudo -S  find . -type f -not -name 'appsettings.json' -exec rm -rf {} + < /home/icodex/deployment_Scrips/passwd
cd /home/icodex/azagent/_work/r6/a/_ReviewerOne-InviteAndRefer.NET\ Core-CI/drop/
sudo -S rsync -av --exclude='appsettings.json' --exclude='runtimes' ./ /home/icodex/Dev_Peer-reviewr/InviteAndRefer/ < /home/icodex/deployment_Scrips/passwd
sudo -S systemctl restart DEV-InviteAndRefer.service < /home/icodex/deployment_Scrips/passwd


