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 :
1008_a
2085_a
2130_a
2192_a
2221_a
2242_a
2269_a
2482_a
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
2085_a :
C7V65ANXX_s6_1_M19_0413_SL131164.fastq.gz C7V65ANXX_s6_2_M19_0413_SL131164.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.
Thanks, Ron
_s6_1_
and_s6_2_
in its name?