I have several folders ,where each folder contain two files fastq.gz. Usually they are named as sample_R1.fastq.gz and sample_R2.fastq.gz. where sample_ can represent the folder name ,or something else.
But in my case the folders are :
And each of these folder consists of these files as :
1008_a Files : C85CBANXX_s6_1_O07_0452_SL137634.fastq.gz C85CBANXX_s6_2_O07_0452_SL137634.fastq.gz
How can I rename these files to just like 1008_a_R1.fastq.gz & 1008_a_R2.fastq.gz for folder 1008_a
2085_a_R1.fastq.gz ,2085_a_R2.fastq.gz for folder 2085_a
And so on ,since all other folders have different kinds of patterns inside them.