Answer the question
In order to leave comments, you need to log in
How to write a bash script that executes all the files in a folder?
Hello,
I need to write a script that will run several files in the same folder (at once or one after the other - it doesn't matter). file1.fastq, file2.fastq, file3.fastq and so on using the fastqc module (this is a program in bioinformatics if someone is not in the subject (I myself learned about it the day before yesterday ..))
The script that runs one file works quite well:
#!/bin/bash
#SBASH --time=20:00:00
module load nixpkgs/16.09
module load fastqc/0.11.8
fastqc /home/blabla/files/file1.fastq
-o /home/outfiles
find -name '*.fastq' | awk '{printf("fastqc \"%s\"\n", $0)}'
Answer the question
In order to leave comments, you need to log in
As an option:
find /home/blabla/files/ -maxdepth 1 -name '*.fastq' -exec fastqc {} -o /home/outfiles \;
for file in $(find /home/blabla/files/ -name '*.fastq')
do
fastqc "$file" -o /home/outfiles
done
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question