0

I want to be able to specify a directory with fastq files with a script that will loop through all the files and do some stuff. Here is my attempt:

threads=24
current_path=`pwd`
input_file=${current_path}/raw/

files=${current_path}/raw/*

for file in ${files}; do 

    output_file=${current_path}/${file}_out/
    mkdir -m gu=wrx,o=rx ${output_file}

    spades.py \
    --s1 ${input_file}${file} \
    -t ${threads} \
    --plasmid \
    --careful \
    -o ${output_file}

done

So in this script I get an error: cannot make directory, directory does not exist The script generates a /home folder. I don't know if I am specifying the files incorrectly or if I am using the for loop incorrectly.

Thank you!

Roelof Coertze
  • 586
  • 3
  • 15

1 Answers1

0

you concatenate full path to file with folder in line

output_file=${current_path}/${file}_out/

it should be

output_file=${file}_out/
Maxim Sagaydachny
  • 2,098
  • 3
  • 11
  • 22