I have a folder containing
*.fastq.gz files (R1 and R2) for many samples. For example, in the folder "Raw_WGS", I have several files like
Sample_1_R1.fastq.gz, Sample_1_R2.fastq.gz, Sample_2_R1.fastq.gz, Sample_2_R2.fastq.gz, Sample_3_R1.fastq.gz, Sample_3_R2.fastq.gz
I have another folder e.g. "Analysis" where I have different sub-folders according to the name of my sample sequences. I have sub-folders named like
Sample_1, Sample_2, Sample_3
I have a Text file containing all and ONLY the names of my samples i.e.
Sample_1, Sample_2, Sample_3. Now, I want to move the
*_R2.fastq.gz files for each sample to their respective sub-folder according to the name in the "Analysis" folder.
Can you please tell me how can I do that for all the samples at once? I can use the
mv command to move each file at a time. But I have 1000s of files. So, I want to move them all by running a single script. Please let me know if you have any suggestions.