Rename all files in directory from $filename_h to $filename_half?

前端 未结 11 928
执念已碎
执念已碎 2020-12-02 03:45

Dead simple.

How do I rename

05_h.png
06_h.png

to

05_half.png
06_half.png

At least, I think it\

11条回答
  •  余生分开走
    2020-12-02 04:41

    Although the answer set is complete, I need to add another missing one.

    for i in *_h.png;
      do name=`echo "$i" | cut -d'_' -f1`
      echo "Executing of name $name" 
      mv "$i" "${name}_half.png"
    done
    

提交回复
热议问题