我是一个完整的bash /编码业余爱好者,迄今为止我已经找到了研究此站点的所有答案(很棒)。 我有一个单独的文件夹的每个文件,就像这样:在不同文件夹中重命名具有相同名称的文件,每个文件夹都有一个文件
/aaaa/aaaa.pdf
/bbbb/bbbb.pdf
/cccc/cccc.pdf
但现在,我无法找到或弄清楚bash脚本给他们这样的重命名:
/aaaa/file.pdf
/bbbb/file.pdf
/cccc/file.pdf
我相信它将类似于在复杂性,从这个其他问题,这两条线中的一个: Rename files in multiple directories to the name of the directory
for subdir in *; do mv $subdir/file.txt $subdir.txt; done;
或
find . -type d -not -empty -exec echo mv \{\}/file.txt \{\}.txt \;
要澄清,我的文件夹中运行包含的文件夹/ AAAA/BBBB/CCCC ......
非常感谢您