Linux批量快速修改文件名的三种方法
warning:
这篇文章距离上次修改已过436天,其中的内容可能已经有所变动。
在Linux中批量修改文件名的常见方法有以下三种:
- 使用
rename命令:
rename 's/old_name/new_name/' *.txt- 使用
find和mv命令结合:
find . -type f -name "*.txt" -exec bash -c 'mv "$0" "${0/old_name/new_name}"' {} \;- 使用
for循环:
for file in *.txt; do
mv "$file" "${file/old_name/new_name}"
done以上三种方法可以快速批量修改文件名,选择哪一种取决于具体需求和环境中的工具。
评论已关闭