I have several sub-directories with no unanimous naming pattern within my home directory (for example ~/123, ~/456, ~/789).
Within each of these sub-directories, I have two folders named alignment1 and alignment2. In the folders alignment1 and alignment2 there are several files.
The files of interest to me are named alignment1 (no extension) in the alignment1 folder and the file alignment2 (no extension) in the alignment2 folder.
Please remember that in the folders alignment1 and alignment2 there are other files named alignment, but they have extensions (for example, alignment1.backbone, alignment1.bbcol and alignment2.backbone, alignment2.bbcol in respective alignment1 and alignment2 folders), but I am not interested in these files.
~/123/alignment1/alignment1
~/123/alignment2/alignment2
~/456/alignment1/alignment1
~/456/alignment2/alignment2
etc...
Question:
My struggle is to rename the folders
alignment1andalignment2tosubdirectory_alignment1andsubdirectory_alignment2(for example,123_alignment1and123_alignment2).Then, in the folders
alignment1andalignment2, the alignment files, namedalignment1andalignment2respectively, need to be renamed tosubdirectory_1.alnandsubdirectory_2.aln.Move the
subdirectory_1.alnandsubdirectory_2.alnto home directory.
I think it is closely related to this and this question, but I have been trying to amend the answers in the above postings for last few hours with no success.