title: Iterating through multiple subdirectories to load large batch data
body: <p>newbie to coding and am making a legislative database for use in academic work. I have downloaded the California legislative information into a directory on a partitioned portion of my HD. Loaded the schema to the MySQL DB with no issues, downloaded the data and am having problems getting it uploaded. Lets call my workspace home directory home, within that directory are my modules (I have node in there but I would love to avoid using it until I make an app), my json package and settings files and a subdirectory called pubinfo. This is all set up. </p>
  
  <p>Within the pubinfo directory are my sql table files, and shell commands for loading the data into mysql where I have a DB with tables ready for data insertion, as well as subdirectories for legislative sessions labeled from 2001-2019 by sessions (2001, 2003, and so on by 2 years). The loadData.sh file is below, and the instructions from the California data website said to download these files, unzip them, then to run them on my pubinfo directory...</p>
  
  <pre><code>if [ $# -gt 0 ]; then
    echo Usage: .loadData.sh
    exit 1
  fi
  
  if [ -z "$MYSQL_PWD" ]; then
    read -p "Please enter root password:" MYSQL_PWD
    export MYSQL_PWD=${MYSQL_PWD}
  fi
  
  do
    if [ -e ${lcTable}.dat ]; then
      echo Processing table: ${lcTable}
      if [ -z "$MYSQL_PWD" ]; then
        mysql -uroot -p -Dcapublic -v -v -f &lt; ${lcTable}.sql 2&gt;&amp;1 &gt; ${lcTable}.log
      else
        mysql -uroot    -Dcapublic -v -v -f &lt; ${lcTable}.sql 2&gt;&amp;1 &gt; ${lcTable}.log
      fi
    fi
  done &lt; "tables_lc.lst"
  </code></pre>
  
  <p>When ran, the out put on my zsh terminal is '/usr/local/bin/loadData.sh: line 29: location_code_tbl.sql: No such file or directory', I also have to add that I symlinked the shell file into my path so that the variable could be called in a global setting. I plan to eliminate it once this is all uploaded. I suppose I could symlink all the sql tables as well, but I know there has to be an easier way to iterate through subdirectories while using the sql tables and files in my main directory. I just am not familiar with zsh or bash, I had to take an Udemy course just to set up the MySQL DB. Anyways, I was hoping someone would be able to help, if you have any questions that I did not address here I can answer. Oh and if there is any question on my machine, it is a newer Mac book pro, running the most current mysql version and my editor is visual studio code in addition to the good old terminal.</p>
  
  <p>Thanks!</p>