That depends on your shell. I use zsh
, and this is the way I do it:
for i in *-min.*; do mv $i "${i%-*}.${i#*.}"; done
I advice checking out the manpage of your shell, and checking out a section similar to "parameter expansion" (as it is called in the zsh
man page).
Similar solutions are available for bash
and other shells as well (you did not specify which one you use).
Please note, that your particular solution always depends on the data and your goal. if you have the '-' as separator between the name and the suffix you want to get rid of, this is the way to go. If not, you might want to tailor the param expansion a little bit.
man rename
; it probably exists on your system. Here is an example usage ofrename
. – Wildcard Feb 12 '16 at 06:58