title: Looping through files defined by `*` in a variable in BASH
body: <p>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: </p>
  
  <pre><code>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
  </code></pre>
  
  <p>So in this script I get an error: <code>cannot make directory, directory does not exist</code> The script generates a <code>/home</code> folder. I don't know if I am specifying the files incorrectly or if I am using the for loop incorrectly.</p>
  
  <p>Thank you!</p>