#!/usr/bin/bash

#https://unix.stackexchange.com/questions/505744/mv-get-info-from-files-to-be-overwritten


if ! [ $# -eq 2 ]; then
    printf "%s\n" "Usage: Include exactly 2 fully qualified file names as arguments, as in:" \
    "   $ smv /path/to/source /path/to/destination" "Abort."
elif [ -e "$2" ]; then
    (printf "\n%s\n\n" "Destination file exists."  && /usr/bin/stat "$2" ) 2>&1
    printf "\n" 
    read -p "Clobber it ? (Y/n):  " answer
    case "$answer" in
        N|n) echo "$1 not moved; $2 preserved. Abort.";  exit(11) ;;
        Y|y) \mv -f "$1" "$2" ;;
    esac
else
    printf "\n%s\n" "Destination file does not exist."
    \mv -i "$1" "$2"
    printf "%s\n"  "$1 was moved to $2."
fi


