How to merge folders that have similar (not the same) names, in a folder keeping as its name the common part of the name of the two folders

1

Hello, everybody

I have a list of folders that look like this:
123_S1_R1_001
AND
123_S1_R2_001

456_S25_R1_001 AND 456_S25_R2_001

789_S83_R1_001 AND 789_S83_R2_001

Each of the folder contains a fastq file (eg the 123_S1_R1_001 folder contains the file 123_S1_R1_001.fastq.gz in ).

I would like to merge for example the folders 123_S1_R1_001 AND 123_S1_R2_001, into a folder named 123_S1 keeping both fastq.gz files in it. The dataset contains many files, so the task cannot be done manually.

Thank u for your time, Mania


folders


merge


name-based

• 160 views



Source link