非常简单。
如何重命名
05_h.png
06_h.png
到
05_half.png
06_half.png
至少,我认为这很简单,但除非您已经知道,否则很难用 Google 搜索这种东西。
谢谢....
最佳答案
只使用bash,不需要调用外部命令。
for file in *_h.png
do
mv "$file" "${file/_h.png/_half.png}"
done
不要添加#!/bin/sh
对于那些需要单线的人:
for file in *.png; do mv "$file" "${file/_h.png/_half.png}"; done
关于bash - 将目录中的所有文件从 $filename_h 重命名为 $filename_half?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7450818/