Code: Alles auswählen
Fmvx ()
{
[[ ! $2 || $1 = -h || $1 = --help || ! -f $1 || -e $2 && ! -d $2 ]] &&
echo "\n\t $FUNCNAME filepath/file dir # file => dir/filepath/file\n" &&
return
local filepath=$1
[[ $filepath =~ ^\.*/(.*) ]] && filepath=${BASH_REMATCH[1]}
if [[ $filepath =~ / ]]; then
filepath=${filepath%/*}
else
filepath=
fi
mkdir -p "${2%/}/$filepath" &&
mv -v "$1" "${2%/}/$filepath"
}