How can I rename all these folders at once to remove "-v4"?
My directories look like this:
drawable-hdpi-v4/
drawable-ldrtl-v4/
mipmap-mdpi-v4/
How can I rename all these folders at once to remove "-v4"?
My directories look like this:
drawable-hdpi-v4/
drawable-ldrtl-v4/
mipmap-mdpi-v4/
In bash, dash, zsh and maybe other shells with parameter expansion and assuming that only directories end with suffix -v4, you could do :
for i in *-v4; do mv "$i" "${i%-v4}"; done
Install DoubleCommander (doublecmd). It has a group rename feature (Ctrl+M). https://doublecmd.github.io/doc/en/help.html
If you have installed Thunar - http://freesoftwaremagazine.com/articles/bulk_renaming_thunar/
Try this, we can remove the suffixing 3 characters using below code
find . -maxdepth 1 -mindepth 1 -name '*-v4' -type d -execdir bash -c 'mv "$1" "${1%???}"' mover {} \;
Use find with xargs commands:
find -maxdepth 1 -type d -name '*-v4' -print0 | \
xargs -0 -I % bash -c 'mv -v "%" "$(echo % | sed "s/-v4$//")"'
find - search for files in a directory hierarchy
xarg - executes a command (bash here) with argument from find
echo % | sed "s/-v4//" - removes -v4 from file name