Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-06T19:34:56.977Z
Answers.Text: Thank you for the prompt reply. Is there any other code that you know of for looping the md5 command over different subfolders?
Answers.UserDisplayName: Anik Dutta
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-06T19:39:31.040Z
Answers.Text: 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.
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-06T19:51:54.857Z
Answers.Text: Thank you very much.
Answers.UserDisplayName: Anik Dutta
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-07T01:32:40.287Z
Answers.Text: 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.
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-07T18:51:05.237Z
Answers.Text: Yeah. totally agreed.
Answers.UserDisplayName: Anik Dutta
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-06T19:32:07.320Z
Answers.LastActivityDate: 2022-02-06T19:42:10.923Z
Answers.LastEditDate: 2022-02-06T19:42:10.923Z
Answers.UserDisplayName: M__
Body: <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>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-02-06T20:49:43.003Z
Comments.Text: You posted the same thing in Biostars.org :) https://www.biostars.org/p/9509386/
Comments.UserDisplayName: Supertech
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-02-06T20:55:06.743Z
Comments.Text: Haha yes. Because sometimes I do not get a reply to my questions (may be they are  too naive some times) :(
Comments.UserDisplayName: Anik Dutta
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-02-06T21:01:38.663Z
Comments.Text: Glad you got the answer.
Comments.UserDisplayName: Supertech
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-02-06T23:51:29.313Z
Comments.Text: thats because its on the wrong stack
Comments.UserDisplayName: pippo1980
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-02-07T18:50:52.373Z
Comments.Text: Anyways it is always great to receive feedback on bioinformatics problems. Nice to see that many roads lead to Rome.
Comments.UserDisplayName: Anik Dutta
Tags: <genome><sequence-analysis><illumina>
Title: How to run MD5 check for multiple fastq files in different subdirectories?
ThreadText: # 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.  
  
  ---
  
  