<p>Small modification,</p>
<pre><code>find . -type f -exec md5sum-lite {} \; &gt;&gt; output.txt
</code></pre>
<p>If you use <code>&gt;</code> the output will almost certainly contain a single record.</p>

CC BY-SA 4.0
2022-02-06T19:34:56.977Z
Thank you for the prompt reply. Is there any other code that you know of for looping the md5 command over different subfolders?
Anik Dutta
CC BY-SA 4.0
2022-02-06T19:39:31.040Z
Yes of course ... there are loads of ways to do this. A bash script is good (separate question IMO). However, the > and >> will still be central. In terms of elegance, your one liner looks cool. BTW >> is very likely the solution because of the find approach. One liners are cool BTW.
M__
CC BY-SA 4.0
2022-02-06T19:51:54.857Z
Thank you very much.
Anik Dutta
CC BY-SA 4.0
2022-02-07T01:32:40.287Z
Your welcome. Your  second question (alternative code) is worth asking because of the variety of ways it can answered, e.g. a bash for loop, Python subprocessing, Perl one liner are the  approaches I can think of.
M__
CC BY-SA 4.0
2022-02-07T18:51:05.237Z
Yeah. totally agreed.
Anik Dutta
CC BY-SA 4.0
2022-02-06T19:32:07.320Z
2022-02-06T19:42:10.923Z
2022-02-06T19:42:10.923Z
M__
<p>I have received Illumina sequencing reads for 100 samples. I have 8 <code>R1.fastq.gz</code> and 8 <code>R2.fastq.gz</code> files for each sample in each subfolder. I want to run an <code>MD5</code> check for all the <code>fastq</code> files in each subfolder.</p>
<p>My folder structure looks like:</p>
<pre><code>/mydata/sequencing/clean
/mydata/sequencing/clean/Sample1
/mydata/sequencing/clean/Sample2
......
/mydata/sequencing/clean/Sample100
</code></pre>
<p>I am using the following code being on the <code>/mydata/sequencing/clean</code> directory.</p>
<pre><code>find . -type f -exec md5sum-lite {} \;
</code></pre>
<p>This code is printing the md5 result on Terminal.</p>
<p>How do I get these results printed to a <code>.txt</code> file? Besides, is there a more elegant way to do this MD5 check?</p>
<p>Thank you.</p>

CC BY-SA 4.0
2022-02-06T20:49:43.003Z
You posted the same thing in Biostars.org :) https://www.biostars.org/p/9509386/
Supertech
CC BY-SA 4.0
2022-02-06T20:55:06.743Z
Haha yes. Because sometimes I do not get a reply to my questions (may be they are  too naive some times) :(
Anik Dutta
CC BY-SA 4.0
2022-02-06T21:01:38.663Z
Glad you got the answer.
Supertech
CC BY-SA 4.0
2022-02-06T23:51:29.313Z
thats because its on the wrong stack
pippo1980
CC BY-SA 4.0
2022-02-07T18:50:52.373Z
Anyways it is always great to receive feedback on bioinformatics problems. Nice to see that many roads lead to Rome.
Anik Dutta
<genome><sequence-analysis><illumina>
How to run MD5 check for multiple fastq files in different subdirectories?
# How to run MD5 check for multiple fastq files in different subdirectories?

(Asked by: username_0 on 2022-02-06)

I have received Illumina sequencing reads for 100 samples. I have 8 R1.fastq.gz and 8 R2.fastq.gz files for each sample in each subfolder. I want to run an MD5 check for all the fastq files in each subfolder.
My folder structure looks like:
/mydata/sequencing/clean
/mydata/sequencing/clean/Sample1
/mydata/sequencing/clean/Sample2
......
/mydata/sequencing/clean/Sample100

I am using the following code being on the /mydata/sequencing/clean directory.
find . -type f -exec md5sum-lite {} \;

This code is printing the md5 result on Terminal.
How do I get these results printed to a .txt file? Besides, is there a more elegant way to do this MD5 check?
Thank you.

**Tags:** genome, sequence-analysis, illumina
> **Comments:**
> **username_1**: You posted the same thing in Biostars.org :) https://www.biostars.org/p/9509386/  
> **username_0**: Haha yes. Because sometimes I do not get a reply to my questions (may be they are  too naive some times) :(  
> **username_1**: Glad you got the answer.  
> **username_2**: thats because its on the wrong stack  
> **username_0**: Anyways it is always great to receive feedback on bioinformatics problems. Nice to see that many roads lead to Rome.  

---

## 1 answers

### Answer by username_3 on 2022-02-06. Score: 2 | Accepted answer

Small modification,
find . -type f -exec md5sum-lite {} \; >> output.txt

If you use > the output will almost certainly contain a single record.

> **Comments:**
> **username_0**: Thank you for the prompt reply. Is there any other code that you know of for looping the md5 command over different subfolders?  
> **username_3**: Yes of course ... there are loads of ways to do this. A bash script is good (separate question IMO). However, the > and >> will still be central. In terms of elegance, your one liner looks cool. BTW >> is very likely the solution because of the find approach. One liners are cool BTW.  
> **username_0**: Thank you very much.  
> **username_3**: Your welcome. Your  second question (alternative code) is worth asking because of the variety of ways it can answered, e.g. a bash for loop, Python subprocessing, Perl one liner are the  approaches I can think of.  
> **username_0**: Yeah. totally agreed.  

---

