# Navigate to the parent directory of the folder "r" # Get today's date in the desired format TODAY=$(date +%Y%m%d) # Use rsync to copy directory "r" to "r_BACKUP_$TODAY" while excluding the specified directories rsync -av --exclude 'zip' --exclude 'data' --exclude 'confirmData' . "../r_BACKUP_$TODAY"