Commit 83b51370 authored by nimrod's avatar nimrod
Browse files

scripts: clean-sync-conflicts.

Removes Nextcloud sync conflicts.
parent 102ee715
Loading
Loading
Loading
Loading
+x+29
Changes for Documents/bin/clean-sync-conflicts: 29 added lines, 0 removed lines.
Original line number Diff line number Diff line
#!/bin/sh
set -eu

usage () {
    echo "usage: $(basename "$0") [-h] [-d]"
    echo
    echo "Clears Nextcloud sync conflicts."
    echo
    echo "Options:"
    echo "-d   dry-run (only show the files that would have been deleted)."
    echo "-h   shows this help message."
}

while getopts hd f
do
    case $f in
        h) usage; exit;;
        d) DRY_RUN=1;;
        \?) usage; exit 1;;
    esac
done
shift $((OPTIND - 1))

if [ "${DRY_RUN:-}" = 1 ]
then
    find ~/Documents -name 'SYNC CONFLICT*' -type f
else
    find ~/Documents -name 'SYNC CONFLICT*' -type f -delete
fi