dotfiles/.zsh/functions/ren

11 lines
283 B
Bash

#!/bin/env zsh
# utility to easily rename a file without
# having to type out its path twice
function ren {
from="$1"
to="$2"
DIR="${$(realpath "$from")%%$(basename "$from")}"
# echo "$DIR"
mv "$(realpath "$from")" "$DIR$to"
echo "Moved $(realpath "$from") to $DIR$to"
}