在当前目录及其所有子目录重命名文件名 [英] Rename file names in current directory and all subdirectories

查看:130
本文介绍了在当前目录及其所有子目录重命名文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有4个文件,在不同的目录和子目录的名称如下

I have 4 files with the following names in different directories and subdirectories

tag0.txt, tag1.txt, tag2.txt and tag3.txt 

,并希望将其重命名为 tag0a.txt,tag1a.txt,tag2a.txt和tag3a.txt 中的所有目录和子目录。

and wish to rename them as tag0a.txt, tag1a.txt ,tag2a.txt and tag3a.txt in all directories and subdirectories.

谁能帮我出使用shell脚本?

Could anyone help me out using a shell script?

干杯

推荐答案

这当然也可以用做发现:

This can of course be done with find:

find . -name 'tag?.txt' -type f -exec bash -c 'mv "$1" ${1%.*}a.${1##*.}' -- {} \;

这篇关于在当前目录及其所有子目录重命名文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆