#!/bin/sh
ANDROID=$(find $HOME/.kde/share/apps/kdeconnect -maxdepth 2 -type d -name Android|head -n 1)
MNT=${ANDROID%%/Android}
BACKUP="$HOME/Backup"

if ! [ -d "$MNT" ]; then
    echo Error: Android not mounted, use Dolphin and KDE Connect first! >&2
    exit 1
fi

rsync -avmP --delete-excluded --exclude=/Android --exclude=/storage "$MNT"/ "$BACKUP"
