重命名子文件夹中存在的具有相同名称的文件以包含子文件夹名称

时间:2015-11-04 23:04:10

标签: linux unix rename mv

有多个文件夹..folder1,folder2..foldern,每个文件夹都有很多文件,但每个文件夹中都有一个名为sample.txt的文件。

有没有办法重命名所有sample.txt,以便将它们重命名为父文件夹的名称 例如。 folder1 / sample.txt - > folder1.txt folder2 / sample.txt - > folder2.txt .. foldern / sample.txt - > foldern.txt

1 个答案:

答案 0 :(得分:0)

FILES = $ PWD / Feline_combined / * /

for $ FILES

DO

cd $ f

测试= $ {PWD ## * /}

echo $ test

cp fastqjoin.join.fastq~ / Desktop / Shared_Folder / Project_VRB / shell / $ test.fastq

完成