Rename files using `mv` command without typing the full name twice ↦
Nice little function to add to your .bashrc
:
function mv() {
if [ "$#" -ne 1 ] || [ ! -e "$1" ]; then
command mv "$@"
return
fi
read -ei "$1" newfilename
command mv -v -- "$1" "$newfilename"
}
Click through for usage examples and a lively discussion in the comments about other ways of achieving similar things.
Discussion
Sign in or Join to comment or subscribe